Posts by Diego Zanardo • 3,301 points
100 posts
-
1
votes1
answer874
viewsQ: Unit Tests in Controller mocking EF Context
I’m not getting a solution on how to test my application (mocking the EF context) EF context: public class SawluxContexto : DbContext { public DbSet<Restaurante> Restaurante { get; set; }…
-
6
votes1
answer775
viewsQ: Mandatory field rule should be on the backend or frontend?
I’m building an application where the backend is an API and the frontend is Angular2. In a user’s registration I do a validation in the API and if a required field is not filled in the API returns…
-
3
votes2
answers206
viewsQ: Where to place the View Model rule
I need to create a View Model to use on the screen. I’m wondering where to put the button rule be enabled or not. I thought about this implementation, I would like to know if it is the best way.…
-
3
votes1
answer107
viewsQ: Method with many if and Return
I think my code is too polluted with a lot of if. [ValidateModelAttribute] [HttpPut("{id}")] public IActionResult Put(int id, [FromBody]UserDto model) { try { if (model == null || model.Id != id)…
c#asked Diego Zanardo 3,301 -
0
votes4
answers275
viewsQ: API project with many layers
I’m studying about API. I saw a design pattern with these layers: I found the layers Appservices and Domainservices unnecessary. For me the ideal would be to create only one layer of Services where…
-
3
votes1
answer2138
viewsQ: Func<T, bool> and Expression<Func<T, bool>>
Well I’d like to know first what the difference is between Func<T, bool> for Expression<Func<T, bool>> And how do I convert from Func<T, bool> for Expression<Func<T,…
c#asked Diego Zanardo 3,301 -
1
votes1
answer455
viewsQ: Filter database-level results Entity Framework
I have the following question about using the Entity Framework. I have an abstract class for the class that communicates with the base. Aiming at the performance want instead of bringing all the…
-
4
votes1
answer110
viewsQ: Deserialize Json List
For when the return is only 1 record I use the following: { "id": "27", "name": "Daft Punk", "link": "https://www.deezer.com/artist/27", "share":…
-
2
votes0
answers47
viewsQ: Phonegap wifi network
There is a way to recover network information that the device is connected to? I would like to send to the web service the network where the device is connected.
apache-cordovaasked Diego Zanardo 3,301 -
5
votes2
answers1857
viewsQ: OSI error when published application
When I publish my application, the following error appears: This Operation requires IIS Integrated pipeline mode. Description: An unhandled Exception occurred During the Execution of the Current web…
-
2
votes1
answer466
viewsQ: Mapping of Associative tables with Entity Framework
I have the following problem: A client has tasks for each day of the week. Example: Client A - Saturday - Wash Car, Clean House... Map it as follows: public class Cliente { [Key] public int Id {…
-
8
votes2
answers339
viewsQ: Where to put Data Annotation? View Model or Model?
Using Entity Framework Code First, with view model and model. To create a column with varchar(2), need to put the MaxLength(2) in the model and in the view model?…
-
2
votes1
answer40
viewsQ: Mysql Data Entities with Mysql Data 5.3.7
I wonder if there’s any way to use the MySQL.Data.Entities with the version of MySQL.Data 5.3.7. In the specification here speech that works with the MySQL.Data (6.4.4.0). Is there any other way to…
-
3
votes1
answer1213
viewsQ: font-face error when publishing project
I’m with an MVC project. When executed in localhost as fonts normal, but when publishing to the server they give error. CSS @font-face { font-family: 'FontAwesome'; src:…
cssasked Diego Zanardo 3,301 -
1
votes3
answers995
viewsA: Disable all Dropdownlist Options s less what is selected
You need to go through all the options and then add the disabled us options who are not with select: $(function() { $("#mySelect > option").each(function(i){ if(!($(this).is(':selected'))){…
-
7
votes1
answer185
viewsQ: Why does this query return *?
Why this query returns to me *? select convert(varchar(2), 141) I thought it was the ascii table, but the 141 doesn’t match the *. Utilise SQL Server 2008 R2…
sqlasked Diego Zanardo 3,301 -
0
votes1
answer48
viewsQ: Convert Dictionary to Array
I have a Controller that generates a list of Graphs as you can see below: [EXEMPLO DE DADOS] Pergunta: Estrutura Dados: [1, 3] [2, 5] [3, 1] [4, 0] [5, 10] Pergunta: Organização Dados: [1, 2] [2, 0]…
-
3
votes1
answer80
viewsA: Apply style to first line after n
You may be using the CSS ::first-line Selector Example: div::first-line { font-weight: bold; } <div> Lorem ipsum dolor sit amet,consectetur adipiscing elit. <br /> Vestibulum erat velit,…
-
14
votes3
answers13485
viewsQ: Change the Datetime Timezone.
I am hosting my system on a server that is in the USA. So when using the DateTime.Now returns the date and time of the US. I would like you to return the date and time of Brazil. It is possible?…
-
0
votes3
answers241
viewsA: URL of route being incorrectly mounted
Controller: public ActionResult Editar(int id) { return View(); } [HttpPost] public ActionResult Editar(string teste) { return View(); } In his View: @using (Html.BeginForm()) { <input…
-
1
votes1
answer96
viewsQ: Lambda com List
I have the classes: public class Modulo { [Key] public int ModuloID { get; set; } public int SatisfacaoID { get; set; } public virtual Satisfacao Satisfacao { get; set; } public virtual…
c#asked Diego Zanardo 3,301 -
3
votes1
answer781
viewsQ: Using the Signalr
Well I’m starting to venture into Signalr. I decided to follow this Tutorial. Good after doing all the steps, when executing the project presents me the following error: Unhandled Exception at line…
-
1
votes1
answer99
viewsQ: Code First One to Many
My setting: public class AlunoAvaliacao { public int AlunoAvaliacaoID { get; set; } public DateTime Inicio { get; set; } public DateTime? Fim { get; set; } public virtual int AvaliacaoID { get; set;…
-
2
votes2
answers351
viewsA: Binding in text field
From what I understand you’re putting in the User.Identity.Name the user name and what you need is the ID. So you have to search in the flock the ID that corresponds to the Name that is in…
-
1
votes1
answer64
viewsA: Problem to the popular Datagrid
I don’t usually work with the Binding this way. I will put down the way I use it. First: In the DataGrid just point Itemssource to Binding. And add to Binding the Path: <DataGrid…
-
4
votes3
answers6557
viewsA: Get logged in user
First place, the FormsAuthentication.SetAuthCookie receives a String and a Boolean, SetAuthCookie(String, Boolean). Cannot be SetAuthCookie(Usuario, Boolean), how are you doing. Soon it would look…
-
6
votes2
answers18126
viewsA: Open DIV after clicking a Link Button
HTML <div id="escondido"> Eu irei aparecer </div> <a href="http://google.com" target="_blank" id="Clique">Clique aqui</a> CSS #escondido{ display:none; } Jquery $( "#Clique"…
-
4
votes2
answers2266
viewsQ: Publish application with Entity Framework + Mysql
I’m using the Entity Framework for Mysql. I installed the .Net Connector, and the MySQL.Data.Entities. Locally it is working normally. But when I go up to the LocaWeb, will not. The following error…
-
2
votes1
answer4486
viewsQ: Entity Framework Connection with Mysql
I did the procedures outlined in these questions: Entity Framework - Bank Compatibility Error Mysql Connection Asp.net MVC I installed Mysql.Data.Entities. My web.config looked like this:…
-
1
votes2
answers185
viewsA: Animation in Site Sections
An example for you to have a start: The jquery: var divs = new Array("#descricao", "#imagem"); $(document).scroll(function () { var y = $(this).scrollTop(); divs.forEach(function (entry) { if (y…
jqueryanswered Diego Zanardo 3,301 -
0
votes2
answers460
viewsQ: Build possible combinations
I have the following classes: public class Categoria { public int Id { get; set; } public string Nome { get; set; } public bool Primeiro { get; set; } } public class Opcao { public int Id { get;…
c#asked Diego Zanardo 3,301 -
0
votes2
answers115
viewsQ: Line misalignment
Using the bootstrap I have the following code DEMO: <div class="container"> <div class="page-header"> <h1>Seja bem vindo <small>Selecione um curso:</small></h1>…
-
0
votes2
answers90
viewsQ: Extra information on a user login
My scenario is this:: The user will log into the system. Then a list of items will be displayed and he will choose a. Then I need the system to store the logged in user and the item he chose. I…
-
1
votes4
answers2911
viewsA: Entity Foreign Key Framework
I managed to come up with a solution. I’m not sure why it works, or if it makes sense to make it work. Solution If before I upgrade I give one Clear() in the list, it no longer generates the error.…
-
3
votes1
answer151
viewsQ: Entity Framework - N to N, clear list
public class Aluno { public int AlunoID { get; set; } public virtual ICollection<Turma> Turmas { get; set; } } public class Turma { public int TurmaID { get; set; } public virtual…
-
4
votes1
answer394
viewsQ: Code First Table Migration - N to N using Fluent API
I have the following classes: [Table("Area_Cursos_Turma")] public class Turma { public int TurmaID { get; set; } public virtual ICollection<Aluno> Alunos { get; set; } }…
-
2
votes1
answer118
viewsA: Make a foreach that does not repeat the same data
You can do it using the GroupBy. _listaUnidade = db.Apresentacao .Where(un => un.Codigo_Unidade_Negocio == _idmotivo.Codigo_Unidade_Negocio) .Select(u => new MontaArvoreAcao { Unidade_Negocio…
-
4
votes1
answer349
viewsA: problems with the radio button in an html form
Add the name equal for the inputs. Example: <form action=""> <input type="radio" name="sex" value="male">Male<br> <input type="radio" name="sex" value="female">Female…
htmlanswered Diego Zanardo 3,301 -
1
votes1
answer566
viewsA: Form with upload to image
[VIEW] @using (Html.BeginForm("Create", "Arquivo", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) <input type="file"…
-
11
votes2
answers3229
viewsA: How to do this using @Renderbody from Asp.net MVC?
A solution to use Ajax, without having to change all their Views for PartialViews, would be making a requisition Ajax in his Action and then just take the RenderBody generated from that View. An…
asp.net-mvc-5answered Diego Zanardo 3,301 -
0
votes1
answer112
viewsQ: Error display foreign key attribute
I have my classes: public class Bandeira { public int BandeiraID { get; set; } public string Nome { get; set; } public virtual ICollection<Curso> Cursos { get; set; } } public class Curso {…
-
1
votes2
answers982
viewsA: How to redirect to another page when user does not have authorization
Based on that question. Add the following method to CustomAuthorizationAttibute: protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) { if…
-
0
votes1
answer83
viewsQ: Entity Framework 1-n
I don’t even know if you’ve been feeling what I’m trying to do. If I try to add a Course to a Flag, that’s fine. But when I try to add a Course list to a Flag, the following error occurs: Additional…
-
2
votes1
answer641
viewsQ: Constructor class Abstract
I’m failing to develop the following environment: public abstract class AplicacaoGenerica<TEntity> where TEntity : class { private IRepositorio<TEntity> repositorio; public…
-
0
votes2
answers1264
viewsQ: Measure time the user is logged in to the system
I need to know how much time the user spends on the system. That is how long it remains, from the moment it makes the login, to make logout OR close/browser/disconnect PC/disconnect connection, etc.…
-
2
votes1
answer221
viewsQ: Application Layer
Based that question and that other question, in an environment that uses the Entity Framework and Asp.net MVC. I see in many examples the non-use of the application layer, a use of the data layer…
-
3
votes2
answers275
viewsQ: Multi-level in an OL
I’m trying to get the following result: Presentation 1.1. Content 1.2. Programming 1.2.1. JAVA 1.2.2. DOTNET Completion 2.1. Acknowledgements 2.1.1 Family 2.1.2. Teachers End Through the following…
-
3
votes3
answers140
viewsQ: Sort images by height of each one
I have a list of images with different dimensions. I wanted the images to be sorted from the smallest to the largest: the one that has height the minor was first and the height longer last. Using…
-
1
votes3
answers613
viewsA: How popular Dropdownlistfor with information from a foreign key?
The strange thing is that his class Veiculo, refers to only one ModeloVeiculo, and when using a CheckBox, you would be allowing the user to select more than one option. Which I find somewhat…
-
3
votes2
answers275
viewsQ: Mount html by c#
I believe you have a better way of doing this, because when I did it made perfect sense now I don’t mean anything else, so it gets very confusing: I have A field in the table that stores the…