Posts by Barbetta • 5,587 points
191 posts
-
2
votes1
answer212
viewsQ: What is the difference between Integrated Security and Persist Security?
In connection strings with SQL Server I usually see the options Integrated Security and Persist Security, What each of them means and what values they can receive? This doubt arose me seeing the…
-
0
votes1
answer110
viewsA: Recording date range, with useful days in Dictionary
I made 4 options of methods for calculating dates, two with list and two with Dictionary Follows Code public static List<DateTime> DatasUteis1(int quantidade) { List<DateTime> datas =…
-
1
votes1
answer29
viewsA: LINQ query for object with a sub-list
An alternative is to do as follows: var listInsumo = seuContexto.Insumos.Include(p=> p.Dados).ToList(); Use the Include to make join, if you need to Another way: var listInsumo = from insumo in…
-
0
votes2
answers100
viewsA: How to recover address ID?
The default route looks something like this: routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Account", action = "Index", id = UrlParameter.Optional…
-
1
votes1
answer85
viewsA: At runtime, does the Form ID Asp.net webforms change?
Yes, you can use the ClientIDMode <asp:HiddenField runat="server" ID="MenuSelecionado" value="processo" ClientIDMode="Static"/> You can see more about him in documentation Alternative: Keep it…
-
3
votes2
answers234
viewsA: How can I get the Insert in log with logged in user ? Identity - Asp.net core 2.0
You can use the UserManager to catch the current user, your code would look like this: private readonly SignInManager<ApplicationUser> _signInManager; private readonly ILogger _logger; private…
-
1
votes4
answers102
viewsA: Problems with click jquery
An alternative is to create a function for this and already "draw" the element on the screen with this function, your code would look like this: <script type="text/javascript">…
-
2
votes1
answer70
viewsA: List items in addition to the database in Combobox in c# winforms
Based on that reply of the OS is not possible add directly a new item in the combobox that is filled through the Datasource, to do this you will need to add the item to the object being made the…
-
5
votes1
answer668
viewsA: Pass parameter to another page
Instead of two actions has only one and allows the ID be it nullable and do the treatment inside her. public IActionResult OnGet(int? id) { if (id.HasValue) { ContasReceberVM = new…
-
0
votes2
answers452
viewsA: LINQ (LAMBDA) How do I add another list of objects to my Where? c#
To use AND and OR with lambda the operator is used && and || Let’s assume you have next class: public class Operation { public string Name { get; set; } public DateTime StartDate { get; set;…
-
4
votes1
answer40
viewsA: How to remove /home/ from a View URL specifies ASP.NET MVC5
It is possible yes, for that change your RouteConfig You’ll probably have the following code there: routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller =…
-
1
votes1
answer145
viewsA: Load input text after select
I edited the method Carrega passing the id to the data and set the return within the input function Carrega(id) { $.ajax({ type: "post", url: "/PessoasServicos/CarregaDados", data: { id: id },…
-
1
votes1
answer223
viewsA: Load select via ajax
When you pass the Json new Upshot, the field that will have the values of the list. Just do it this way: public async Task<IActionResult> Load() { var resultado = _context.PlanosServicos…
-
1
votes1
answer254
viewsA: Change only edited columns
You can indicate to the Entity which properties will not have their status changed using the IsModified = false, follows an example: public void Update(Classe minhaClasse) { if…
-
0
votes2
answers94
viewsA: Creating a foreach as a result of an Entity query
I didn’t answer before because I was too busy. The problem is because you are returning a single item of "01:00" value and passing this value by foreach will return each char of string, you can see…
-
1
votes2
answers212
viewsA: Search in lambda query with logical operators
Other option: As Gabriel said, you’d have to use the operator && instead of || You can in the query lambda check if the parameter is null and if so, returns true which would be the…
-
0
votes2
answers110
viewsA: transform sql with subquery into query in Entity
Try this way, when giving include, is already made the sub query var retornoColaborador = db.Colaboradores.Include(p=> p.Pedidos).Select(p => new { p.ColaboradorId, p.Nome, p.Pedidos.Count });…
-
0
votes4
answers1437
viewsA: Get user logged in to Asp.Net Core 2.0
Complementing(Another option)... another option to catch the logged in user is to do this directly by controller private readonly UserManager<Usuario> _userManager; public…
-
3
votes1
answer43
viewsA: Querry Lazy Loading in EF Code First
To disable in query specifies do so: db.Configuration.LazyLoadingEnabled = false; Company company = db.Comanies.Find(id);
-
10
votes1
answer3773
viewsQ: What is this Apache Kafka?
I was researching on Microservices integration and I came across this Apache Kafka. I did some research here and I saw him being cited in this Microservices integration response and in that other…
-
1
votes2
answers65
viewsA: When placing a class in Dbset using Migrations
The class creation behavior in the database is already expected because of the relationship, having a relationship with the class Category it will understand that there is a field "FK" and for this…
-
15
votes2
answers4119
viewsQ: Difference between DTO and Viewmodel?
In this question we can see that it is Viewmodel: What good is a Viewmodel in ASP.NET MVC? In this other question we can see what DTO is: What is a DTO? But after all: What is the difference between…
-
1
votes2
answers173
viewsA: C# - Filter Include - Context
I made a model here that has the option "where" in the 3 models and returns ConsultaIntramexRegras. public ConsultaIntramexRegras obterRegraConsultaIntramexPorId(int id) { ConsultaIntramexRegras…
-
2
votes3
answers666
viewsA: ASP.NET - How to use multiple post methods in the same controller?
Complementing... You’re making a mistake because of the lack of route Default, because its configuration routes it always enters the controller and action Userinfo. routes.MapRoute( name: "Default",…
-
0
votes1
answer17
viewsA: Generate a single page with all records
I believe you wish to return the list of all the altered notes, so you can do it as follows: public async Task<IHttpActionResult> Get(string cnpj, int numero, string chave) { var notaDb =…
-
0
votes1
answer83
viewsA: Add Dropdownlist value to the database
Two options to be made is manual or with the enum, below follows example of the two forms Handbook: Create a select <select id="Info" name="Info"> <option…
-
1
votes2
answers1043
viewsA: How to use token authentication with Webapi . Net
I was not very clear about your doubt, but there is no need for a if to compare the token, own framework does so internally. Example: In his startup.cs , you will probably have a method similar to…
-
1
votes1
answer31
viewsA: Convert value to display in table - mvc Asp-net.core
One option is to open a code block, it would look like this: <td> @{ var horario = item.HoraInicio; //logica } <label>@horario</label> </td> Another option is to have a field…
-
1
votes3
answers1447
viewsA: Help select to bring field even if null
You can do it using the left join See who was selected people and is made a left join so that it brings even having no orders, no sum also added a checker that if null, will bring the value 0 SELECT…
-
1
votes2
answers51
viewsA: How do I get these balls out?
Removing the space marker Clutter: CTRL+R+W. Way: Edit>Advanced>View White Space. Removing Outlining(Collapse) To remove the Outlining go in Tools>Options>Text…
visual-studio-2017answered Barbetta 5,587 -
0
votes1
answer827
viewsA: The configuration section cannot contain a text or CDATA element
I ran some tests here and in your section appSettings is coming with a white space and this is causing the error as there is a text element in the section, the white space. see in the image below…
-
1
votes2
answers719
viewsA: Refresh ajax mvc core page
From what I understand, you want to save/edit an item and the list to be updated, below follows an example of how you can do: In the example, after saving/editing the list is loaded again. I’m not…
-
1
votes1
answer205
viewsA: Delete User Identity
Response based on this reply of OS: In the code below is deleted all logins users of the roles and finally the user // POST: /Users/Delete/5 [HttpPost, ActionName("Delete")]…
-
0
votes2
answers111
viewsA: load disables jquery functions
possible Solution a: Add the code to callback of load $(".menu").load(location.href + " .menu > *", function(){ $('.cat').click(function (e) { e.preventDefault();…
-
1
votes2
answers343
viewsA: Combobox slowing form loading winforms C# visual studio data
Another option would be to load the Dropdown asynchronously, so it wouldn’t stop the form while it is loaded: Create an asynchronous method as follows: private async void CarregaDropDownCidades() {…
-
1
votes1
answer118
viewsA: Is it possible to use the Entity framework from a class library?
Yes, it is totally possible to separate the project into class libraries even has a question here at SO-PT on performance Example of how to separate in projects: In a blank solution create 3…
-
1
votes2
answers347
viewsA: Sending Text from an Enum display by Json
Another option, using extension method and the attribute Description would be: Enum: public enum Status { [Description("Aguardando Aprovação")] AguardandoAprovacao = 0, Aprovado = 1, Recusado = 2 }…
-
0
votes1
answer43
viewsA: Formdata: Why does the URL appear undefined?
To get the value on formData use the get url: objeto.get("caminho") You can see more about this documentation To fill the formData you can also do so: var objeto = new…
answered Barbetta 5,587 -
0
votes1
answer175
viewsA: Format date using Htmlhelper
There are some options to be made, follow some of them @Html.Label(item.DataNascimento.ToString("dd/MM/yyyy")) or @Html.Label(item.DataNascimento.ToShortDateString()) Or In your class add to…
asp.net-mvc-5answered Barbetta 5,587 -
0
votes3
answers44
viewsA: Insert text from text boxes and read only after |
It’s a little confusing the question, but to get the value after the |. it is possible to use the split and pass the index. The split will make a array of strings, but if you have more than one |…
-
0
votes1
answer75
viewsA: PHP - You have an error in your SQL syntax;
You’re not closing the query correctly, a ")" is missing at the end of the Insert $query=mysqli_query($conn,"INSERT INTO ingredientes (Nome, calorias) VALUES ('$nome','$calorias')") or…
-
1
votes1
answer35
views -
1
votes1
answer49
viewsA: AJAX function does not pass output to another function
The problem occurred because by default the returns from json no. NET Core are in Camel Casing, and the first letter is lowercase. One way to break this is in Startup.cs "inform" that you want the…
-
1
votes3
answers2989
viewsA: Problem when initiating visual studio solution
From what I’m seeing your project is testing, testing projects are not debugged in the "traditional way". I don’t know if there are any other options, but the one I know is Test Explorer, to open…
-
1
votes1
answer843
viewsA: Error running Dropdownlist on ASP.Net MVC
The error occurs because in your sex list(new SelectListItem { Text = "Masculino", Value="1"}) doesn’t have the field Sexoid, however in its DropDownList(@Html.DropDownListFor(e => e.SexoID...))…
-
1
votes3
answers72
viewsA: Filter specific file to not delete
Follow one more option using linq string[] arquivos = Directory.GetFiles(@"C:\temp\ae", "*.exe", SearchOption.TopDirectoryOnly).Where(p => p != "teste.exe").ToArray(); foreach (string arquivo in…
-
3
votes1
answer85
viewsA: Read from a pre line defined in txt
You can do it this way string cpf = File.ReadAllLines(@"caminho\arquivo.txt")[3]; in case is passed the line index(3 because the indicies start at 0) Another alternative is to put all lines in a…
-
1
votes2
answers910
viewsA: Call a method every time a Controller is triggered Asp.net mvc
It’s not very clear what you’re trying to do, but from what I understand, on your page layout is being called some action, you can do it this way _Layout.cshtml: <ul class="rd-navbar-top-links…
-
1
votes3
answers330
viewsA: How to return type radio value
If I understand correctly, you want to bring a preselected item, so was added the checked in the first item and load page is already made the call of the method that returns the selected value. I…
-
3
votes1
answer2358
viewsA: C# - How to print all the values of an array with the Console.Writeline(??);command?
There are some options, here are some int[] original = new int[] { 2, 5, 3, 8, 9, 12, 15, 7 }; int[] copia = new int[original.Length]; for (int index = 0; index < original.Length; index++)…