Posts by Aesir • 1,076 points
33 posts
-
2
votes1
answer154
viewsA: C# take a part of a String
You can break the string when you find the dash and take the first part(Dice 0), if there is no dash returns the integer value var valor = "123-123"; var valorTratado = valor.split('-')[0]; .net…
-
1
votes1
answer32
viewsA: ASP.NET read data from a POST ajax
First you have to enable on the page or on the master page the page methods: <asp:ScriptManager ID="scriptmanager" runat="server" EnablePageMethods="true" /> Then create a class to represent…
-
1
votes1
answer39
viewsA: How to share menu between ASP.net core applications
You can solve the problem by dynamically loading the items and css/js from the menu: Stores menu items in the database and in the user’s login you search them and store them in Sesssion or something…
-
3
votes3
answers948
viewsA: Limit maximum number of lines in a textarea
You can use jquery and the attribute maxlength to control line breaks, the problem is that it depends on the amount of characters that each line accepts, for that you will have to calculate the…
-
3
votes1
answer51
viewsA: Only seconds on input
Place type="number", max="60" e min="0" input, or configure the max as you wish if it is longer than one minute <input type="number" max="60" min="0"/>…
-
0
votes2
answers190
viewsA: In Development Code First how do I relate the Aspnetusers table to other tables
How to relate their entities has already been answered, but there is another way to do this without relating them: When your user logs in you create a User class with the aspNetUserId property and…
-
0
votes1
answer103
viewsA: Api gets date with changed month and day if parameter is sent by url
After following Several tutorials, having tried several ways to fix this by configuring the application, the best option was to create a component using Vue.js, for inputs that are date. It formats…
-
0
votes1
answer103
viewsQ: Api gets date with changed month and day if parameter is sent by url
I have an api that gets a date (the date is sent as string and received as Datetime): [HttpPost("ObterDados")] public JsonResult ObterDados(DateTime data) { //codigo if I post with the parameter in…
-
3
votes1
answer374
viewsQ: How to get the value of el in the Vue?
I have the variable Vue: var appExemplo = new Vue({ el: "#appExemplo" }); How can I take the value that’s in el? That in this example would be #appExemplo. This.el return undefined.…
-
10
votes2
answers1301
viewsQ: Differences between compiling and recompiling?
Some Ides like Visual Studio have the options to compile and recompile the project, what is the difference between the two and what do they perform differently? And when each should be used?
-
0
votes1
answer288
viewsQ: Api receiving date with changed month and day
I have a class: public class Filtros{ public DateTime DataInicial { get; set; } public DateTime DataFinal { get; set; } //outros campos... } I have a C# API that takes the class:…
-
5
votes2
answers10597
viewsA: Place image in html that is in google drive
I figured out a way: If you put the image id in this url, sure: https://docs.google.com/uc?id=idDaImagem the image id I got from the command link it generates:…
google-drive-apianswered Aesir 1,076 -
1
votes2
answers10597
viewsQ: Place image in html that is in google drive
How to put the google drive image address in src of an img? the folder is published (for all) and the generated link is this:…
google-drive-apiasked Aesir 1,076 -
1
votes1
answer67
viewsQ: How to set an equal value for an object property on all objects in a list?
How to set a value for a property in all list indices without looping? object: var objeto = { nome: "", ativo: false } list: [{"nome": "Carlos","ativo":false},{"nome": "Joao","ativo":false}] In this…
javascriptasked Aesir 1,076 -
0
votes2
answers131
viewsA: API does not receive list post
The problem was that I had a model with a list of contracts in it, so: public class ContratoListaModel{ public IEnumerable<Contrato> Contrato { get; set; } } And I was getting in the API the…
-
3
votes2
answers131
viewsQ: API does not receive list post
I have an API that receives a post, if I receive only a single contract, it receives the data normally: [HttpPost("GravaContratos")] public async Task<JsonResult> GravaContratos(ContratoModel…
-
0
votes2
answers347
viewsA: Sending Text from an Enum display by Json
I made a code that returns the text of [Display(Name = "texto"], for those who need to return it to the screen by javascript or in some other way. public static string GetDisplayNameEnum(Enum…
-
2
votes2
answers347
viewsQ: Sending Text from an Enum display by Json
Guys, I’ve got an Enum for days of the week, being: Segunda = 2, [Display(Name="Terça")] Terca = 3, Quarta = 4, Quinta = 5, Sexta = 6, [Display(Name = "Sábado")] Sabado = 7 So I build an object that…
-
4
votes3
answers1367
viewsA: How to inform that a particular store is open at that time
If it is something for study, or curiosity, using only javascript and jquery you can do so: $(document).ready(function() { atualizaAtendimento(); setInterval(atualizaAtendimento, 60000); // 60 *…
-
11
votes3
answers147
viewsQ: How to put Html snippet on all child elements except the last one?
I have a dynamically generated table, and I want to put a input within each td. I can get the id of the tr, then I do: $("#id").children().html("<input type='text' value='" + valor + "' />");…
-
2
votes2
answers1410
viewsQ: Remove all records from a table with Entity framework 6
How to delete all data from a database table using EF6 without having to query (I want to delete all records)?
-
5
votes1
answer1179
viewsQ: Error entering data into database, EF 6
I’m trying to input data into the database, but I have a mistake in doing the saveChanges(); after doing several times the context.add(), has happened after 500, 2200 and 5500 times. Error: The…
-
6
votes3
answers13362
viewsQ: How to remove whitespace from a text?
I was trying to get blanks out of a string, but the .Trim() does not work, it displays the white spaces yet: var teste = texto.Trim(); txtConteudo.Text = teste; For example, if he receives: "text ",…
-
2
votes1
answer97
viewsQ: Entity Framework Extra column when using Icollection
If I have two tables in the bank, for example: tabela1 and tabela2, and in the tabela1 I have a ICollection of tabela2: public class tabela1{ public Guid tabela1Id {get;set;} //campos... public…
-
3
votes1
answer211
viewsQ: When mapping class to viewModel, some data is lost
I have an appointment that returns a client and his phone, but when mapping the class to the viewModel, I lose phone data: consultation: public Cliente ObterClientePorId(Guid ClienteId) { var…
-
3
votes1
answer2091
viewsQ: Make a button to add properties to a list using Begincollectionitem C#
I have a register of people and need to create a button to add multiple phones and send to my controller, I am using Begincollectionitem, based on my other question Form using Begincollectionitem…
-
2
votes1
answer957
viewsQ: Form using Begincollectionitem gets null viewModel in foreach
I want to make a form where I can register several addresses and phones to a single person, and I want to be able to do this when I’m registering the person. Based on the answers to my other…
-
1
votes2
answers772
viewsQ: Register only some data from a C# Asp.net MVC 5 form
I have a person registration form, where I also already register her address, there arose the need to be able to register more than one address for the same person at the time I am registering her,…
-
-1
votes1
answer952
viewsQ: Read a. txt file in ANSI VB.net
I’m trying to read a text file using basic visual, but it puts "?" in the words with accent and cedilla, for example, how do I make him read the files in ANSI format ? this doesn’t work: Dim ArqTemp…
-
2
votes2
answers2201
viewsQ: Person registration using multiple viewModels and only one controller
I want to register a person, which I have divided into three entities: Person, Contact and Address. And I want it to be just a registration form. My create action in the person controller looks like…
-
4
votes4
answers14354
viewsQ: Line break in bootstrap
I’m making a form, and I have the following code: <div class="row"> <div class="col-md-6"> @Html.EditorFor(model => model.Nome) </div> <div class="col-md-6">…
-
1
votes2
answers705
viewsA: Error while deleting using Entity Framework 6 and custom repository
I could not fix this error, so I decided to change the way how to delete. I made my controller only receive the id instead of the object: [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken]…
-
3
votes2
answers705
viewsQ: Error while deleting using Entity Framework 6 and custom repository
I am using the Entity framework to do CRUD in the database, but I have an error trying to delete an item: "The Object cannot be Deleted because it was not found in the Objectstatemanager." I’m using…