Questions tagged as 'c#'

2
answers

How to pass a parameter from one Action to another Action on the same Controller

I need to send a parameter of an action to another action on the same controller, but the parameter is "zeroed". How can I do this? Below the code I'm doing: [Authorize] public class ItemMaloteController : Controller { public IActionResult...
asked by 19.11.2018 / 04:59
1
answer

Regular expression to validate text

I'm doing a method that will import some data, and before importing I need to check if some fields are correctly filled in, the fields should come this way: Example: Jan/Seg Fev/Ter Mar/Qui The data must be in this exact format, where th...
asked by 21.11.2018 / 13:33
2
answers

Timer saying when it's ending

How can I make the timer notify when it's running out of Console? It cleans the console every 1 hour Example: > Falta 3 segundos para o terminar > Falta 2 segundos para o terminar > Falta 1 segundos para o terminar Timer: priv...
asked by 13.03.2018 / 16:09
1
answer

How to Deploy AutoMapper 6.2.2

I'm following a tutorial in which classes are configured as follows: A class named AutoMapperConfig: public class AutoMapperConfig { public static void RegisterMappings() { Mapper.Initialize(x => {...
asked by 20.03.2018 / 18:40
2
answers

Print HTML page keeping the CSS of the page

Good afternoon guys, I have a report that is generated on a page aspx with bootstrap and CSS . The content of the report is within div <div id="pdf2htmldiv">...</div> where I call via javascript for printin...
asked by 07.03.2018 / 20:27
1
answer

Convert an object that implements the interface, in its own interface

I made the following code: using System; public class Program { public static void Main() { //Este método funciona Metodo(new ClasseTeste(){ Obj = new Registro(){ Nome = "Nome Teste"}}); //Este não Met...
asked by 11.03.2018 / 18:57
1
answer

How to call asynchronous method in class constructor?

How do I call a method marked as async in a class constructor?     
asked by 22.10.2017 / 14:01
1
answer

Doubt - Winforms about respect on second screen

Form1 created panel with black background and label with property: AutoSize = False Dock = Fill Font size (Size) = 20 E 2 buttons for forward or backward lettering Form2 only has black form and a label with property: AutoSize =...
asked by 09.11.2017 / 23:49
3
answers

How to store a single character?

My class has an attribute that is a single character. I can store as string , but I think the correct one would be char . But this attribute can receive a int (between 0 and 9) of another method. How do I save this number in t...
asked by 09.12.2017 / 22:27
4
answers

How to extract data from a SQL query in C #

I've been developing C # for a while now, so I'm still learning ... How do I extract the result data from the query done in the database? public static DataTable ConsultaCidade() { DataTable pDados = ExecutaSql.ConsultaBanco("SELECT * FROM...
asked by 08.12.2017 / 19:09