Posts by Eduardo Sampaio • 1,425 points
80 posts
-
3
votes1
answer475
viewsQ: Using dependency injection outside a controller with ninject
I have following code: public class ContaController : ApiController { private readonly IAppServiceUsuario _app; public ContaController(IAppServiceUsuario _app) { this._app = _app; } } how to inject…
-
0
votes2
answers210
viewsA: Entity Framework 6: Provider Error
The project where it is mapped in webconfig the Connection string must be set as main and use providerName="System.Data.SqlClient" or do with…
-
0
votes3
answers1381
viewsA: What is the difference between Data Annotations and Fluent API?
Using Data Annotations you create a certain coupling in letting an entity coupled to a technology. Fluent API you can separate the responsibility that was previously coupled in the domain layer into…
-
4
votes2
answers474
viewsA: Validation without "Modelstate.isValid"
you can’t do it this way below: if the attributes are exactly the same name as the viewmodel it can receive all the parameters and does not need to deserialize. [HttpPost] public PartialViewResult…
-
1
votes1
answer90
viewsA: How does foreign key in c#?
In a Relationship One for Many Data Annotations public class Student { public Student() { } public int StudentId { get; set; } public string StudentName { get; set; } public int StdandardRefId {…
c#answered Eduardo Sampaio 1,425 -
5
votes4
answers560
viewsQ: How to return correctly the values of calculations with decimals in javascript?
I have following code someone could help as it would be solution for this. var resultado =(parseFloat(126,79) + parseFloat(237,00)).toFixed(2); javascript result = 363,00 correct value = 363,79…
javascriptasked Eduardo Sampaio 1,425 -
5
votes3
answers1227
viewsA: Is there a Data Annotation that prevents data duplication in the Database?
public class User { [Index(IsUnique=true)] public string UserName{get;set;} }
-
0
votes3
answers727
viewsA: Problem with INSERT INTO
an example of persistence using Sqlclient public class Conexao { //declarar atributos.. //protected -> somente pode ser acessado por herança protected SqlConnection Con; //conexão com o banco de…
-
2
votes2
answers56
viewsA: Why is it that when I delete or edit the record from table x it is also removed from table y?
example to remove Cascade delete public class SchoolContext<: DbContext { public SchoolContext():base("MySchool") { } public DbSet<Student> Students { get; set; } public…
-
0
votes3
answers223
viewsA: implement Ixmlserializable interface in a class
follows an example I used to Serialize and Deserialize an XML using C# [Serializable] [XmlRoot("Pessoa"), XmlType("Pessoa")] public class Pessoa { [XmlAttribute("id")] public string Id { get; set; }…
-
2
votes2
answers325
viewsA: Are DDD and Entity Framework mutually exclusive?
DDD is a software modeling approach that follows a set of practices aimed at facilitating the implementation of complex rules/business processes that we treat as a domain.This approach does not…
-
0
votes1
answer60
viewsA: Web Api Asp.net mvc has any data limit reported on Route?
object public class ClientViewModelRegister { public string Name { get; set; } public string Email { get; set; } } [HttpPost] [Route("register")] public HttpResponseMessage…
asp.net-mvcanswered Eduardo Sampaio 1,425 -
2
votes3
answers7584
viewsA: Calling the Controller Method
In ASP.NET MVC the controller flame and through routes in case when you create a project in ASP.NET MVC you already come with a route created Home/Index which means that you will call Homecontroller…
-
0
votes2
answers2325
viewsA: Error 500 when consuming Nfedistribuicaodfe
following this tutorial I made class below these days ta working http://pmarco777.blogspot.com.br/2015/01/download-da-nota-fiscal-eletronica-nfe.html /// <summary> /// Classe download NFe…
-
0
votes3
answers184
viewsA: Return BD values via ajax
Try to do it by GET $(".visits-table tr a").click(function () { var id = $(this).parent().parent().attr("id"); $.ajax({ dataType: "json", type: "GET", url: "/Visits/ReturnVisit", data: { id: id },…
-
2
votes2
answers2001
viewsA: Python Basic Request
>>> import httplib, urllib >>> params = urllib.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'}) >>> headers = {"Content-type":…
-
0
votes2
answers97
viewsA: How to bring an item list
public List<ClasseUsada> FindAll(int pedidoId) { using (Conexao con = new Conexao()) { return con.Tabela.Where(x=>x.Pedidoid.equals(pedidoid)).ToList(); } } Good afternoon follow code with…
-
2
votes1
answer217
viewsQ: Correct way to update a Model from a Viewmodel
I have the following question: do I get one Viewmodel in the Controller of ASP.NET. In the update method I have two options: 1st option : transfer the Viewmodel to the respective bank entity…
-
0
votes2
answers130
viewsA: Removing part of the link on ASP.NET MVC routes
It can create another route or modify the one you are and leave as below : routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new {controller = "Login", action = "Index",…
-
0
votes1
answer170
viewsA: Customize Identityuserclaim
Here’s an example mapping can do separate the way you did more this mode also works. protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder);…
-
3
votes1
answer706
viewsA: Form data validation in ASP.NET MVC
Good afternoon has way but simple server side validation would be using data Annotation it already has some properties ready but wanting you can customize I’ll put an example below. using…
-
1
votes1
answer401
viewsA: Nhibernate create database?
Good afternoon @Fernandopaiva I do this way with Nhibernate he creates the tables in the bank I will leave link to github with project I used it. public class HibernateUtil { private static…
-
0
votes2
answers426
viewsA: Class relationship - (C# Entityframework)
If relationship is a person has an address gets like this: public class Pessoa { public int Id { get; set; } public string Nome { get; set; } ... public virtual Endereco Endereco { get; set; } }…
-
0
votes3
answers3722
viewsA: How to extend a DIV to the end of the screen?
You can use the property: 1vh (viewport height) = 1% of viewport height will stay like this min-height:100vh;
-
0
votes3
answers13886
viewsA: Take the value of a dynamic select
I do it as follows each time your select is chosen or you are selected by the value by a function that is called in the onchange or when changing this value is stored in a variable.
-
4
votes1
answer1111
viewsA: Get url with Javascript without GET
Just try to get the path var url = window.location.pathname
javascriptanswered Eduardo Sampaio 1,425 -
0
votes2
answers93
viewsA: Check two null fields with Data Annotation
You can create a new Notation for this I sent below how to do you will overwrite the method is Valid…
-
0
votes2
answers1744
viewsA: How to change the name property in @Html.Editorfor
try to use Html.Textboxfor(m=> m.Email, new {@name = "desired name" })
-
0
votes2
answers2016
viewsA: Sending Model to Controller via Ajax
Example below; function DeleteUser() { var dados = { Id: $("#deleteuser").val() }; $.ajax( { type: "POST", url: "/Usuarios/Delete", data: dados, success: function (msg) { }, error: function () { }…
-
1
votes1
answer245
viewsA: Exception when generating Controller with Entity Framework
Generating from scaffolding tries to remove last part that selects the Data Conext connection and scaffolding from a model not directly from the entity.