Posts by Ayrton Giffoni • 772 points
27 posts
-
0
votes3
answers5808
viewsA: Problem running Visual studio debugger
According to this article from microsoft, you should follow the following step: If several versions of Visual Studio have been installed and uninstalled on the computer, WF3 debugging may fail with…
-
2
votes2
answers537
viewsA: Show error message when Modelstate is not valid
Complementing the @Leonardo Bonneti response, you should call the unobitrusive validation, because when you use @Ajax, you should reload the js functions you need. Example: @using (Ajax.BeginForm(…
-
1
votes1
answer210
viewsA: Send email to register form
Create a class to send email and call in your method there. Follow the example: using System.Net; using System.Net.Mail; using System.Net.Mime; ... try { SmtpClient mySmtpClient = new…
-
3
votes3
answers679
viewsA: Entity Relationship Framework 1:N
Probably its configuration is Lazyloading = False; If you want to take a look at how it works, click here In that regard, you have two options: 1- Lets Lazy loading = true 2- Dar include what you…
-
0
votes1
answer58
viewsA: How do I mount a List or Ienumerable array in the Controller and move to View?
Example of how to do: public class Pedido { public int ProdutoId {get;set;} public List<Produto> Produtos {get;set;} } on your controller: public ActionResult ExemploController(){ var pedido =…
-
3
votes2
answers1332
viewsA: Relationship one for many and many for an Entity Framework
Example of 1xN mapping: public class Student { public int Id { get; set; } public string Name { get; set; } public int CurrentGradeId { get; set; } public Grade CurrentGrade { get; set; } } public…
-
0
votes2
answers812
viewsA: but this Dictionary requires a model item of type 'System.Collections.Generic.Ienumerable`1[Webapplication4.Models.modelExemplo]
Your view is typed for a IEnumerable<WebApplication4.Models.modelExemplo>, that is, several modelExemplo and in your Return you send only one. Change your view to @model…
-
3
votes3
answers40
viewsA: System.Nullreferenceexception in an attribute of type Stringbuilder
This happens because StringBuilder is a class non-static, that is to say, needs to be instantiated (initialized). Do this in your constructor. public class modelExemplo { public modelExemplo(){…
-
1
votes3
answers495
viewsA: Send email asynchronously Asp.net mvc
Edit: Just follow the example: public async Task SendEmail(string toEmailAddress, string emailSubject, string emailMessage) { var message = new MailMessage(); message.To.Add(toEmailAddress);…
-
1
votes2
answers608
viewsA: Error Object Reference not set to an instance of an Object in c#
You return in your method one IList<Rota>, however, the query returns only one INT (Numcarroid). Change your query to: string hql = $"SELECT * FROM Rota WHERE NumCarroId = {NumCarroId}"; If…
-
3
votes2
answers317
viewsA: Random list in Query Linq to Entity C#
Best way to use is with Fisher-Yates shuffle (algorithm to generate a random permutation of a finite sequence) Create an extension: public static class EnumerableExtensions { public static…
-
5
votes2
answers1520
viewsA: Parameter in bold C#
Edit: pass the value to your variable: string frase = $"A data de hoje é: <b>{DateTime.Now.Date}</b>"; On the spot that your XRLabels receives the variable frase, replace the XRLabels by…
-
1
votes3
answers73
viewsA: How to debug code with Object Initializer format
There is a concept within OO who says that the ideal is for her class to change itself and not externally. I suggest that in order to debug the code and respect this rule, use the constructor to…
-
0
votes1
answer410
viewsA: Display saved image in database and allow user to change image
To display: Model: public class Item { public int Id { get; set; } public byte[] Image { get; set; } } Controller: public async Task<ActionResult> RenderImage(int id) { Item item = await…
-
1
votes2
answers1193
viewsA: ASP . NET MVC 5 - Dropdownlist with Modelstate?
In your viewmodel, create the following attribute: public SelectList TiposProjeto { get; set; } there, where you prepare your screen (controller or some other layer), you popularize:…
-
3
votes2
answers343
viewsA: Many to Many with Fluent API
As we can see in the example here, you need to configure only one side. Example: public class Student { public Student() { this.Courses = new HashSet<Course>(); } public int StudentId { get;…
-
1
votes1
answer121
viewsA: Capture Tracesql query in LINQ c#
Has a reference to the Fluent Nhibernate in stackoverflow in English here Write an Interceptor: using NHibernate; using System.Diagnostics; public class SqlStatementInterceptor : EmptyInterceptor {…
-
3
votes2
answers785
viewsA: Arraylist versus List
List<T> is a generic class. It supports storing values of a specific type without the need to force from or to object. ArrayList simply stores object references. As a generic collection,…
-
2
votes2
answers176
viewsA: How to create a View to insert multiple entities
your view: public class FornecedorViewModel { public FornecedorViewModel() { FornecedorEmails = new List<FornecedorEmailsViewModel>(); FornecedorTelefones = new…
-
0
votes2
answers706
viewsA: Multiple error Object sets per type are not supported
It is probably trying to create the User through the 2 contexts. You should delete the creation within the file generated by Migration. Go to the Migration of your application and the generated file…
-
2
votes3
answers706
viewsA: How to select value in Select
Can be done with Razor through the Dropdownlistfor and by Selectlist. @Html.DropDownListFor(model => model.Variavel, new SelectList(Model.ListaVariavel, "Value", "Text", Model.Variavel),…
-
2
votes1
answer415
viewsA: C# Visual Studio unknown build error
What version of c# are you using? If it’s previous versions or 6.0, test this: LoginTransmit lg; LoginHelper.isLogged(Request, out lg);
-
3
votes1
answer317
viewsA: Put the bug in my view
I think the best in this case would be to create a partialView where you would work the errors and then use the screen and return to Partialview; Example: 1 - Partial error:…
-
0
votes2
answers68
viewsA: Viewmodel with INSERT in two controllers
Dude, I would say that what you want to do would be unnecessary. You can use the same controller to add the two records smoothly. Example: public ActionResult Create([Bind(Include =…
-
2
votes1
answer104
viewsA: Error when using GROUP via LINQ
try changing your select in the query var query = from s in db.Crm_Analise where s.cliente_CRM == cod_cli select new Crm_Analise() { TAG = s.TAG, data_creat = s.data_creat, cod_item_CRM =…
-
2
votes1
answer496
viewsA: Check for list records in the Entity framework
From what I can see, just put that condition inside your where: && p.SeuModelAteChegarNasEntregas.Entregas.Any() After that, he will only bring those who have deliveries. You can add after…
-
4
votes1
answer1157
viewsA: How to take the contents of an HTML Table and convert into a C# List<>?
Place classes in each column, call each row and encapsulate by class. HTML: <table id="tabelaProducao"> <thead> <tr> <th style="text-align:center;">CNES</th> <th…