Questions tagged as 'c#'

1
answer

Use the value of a constant to set a property in the mapping with EF Core

I am mapping a class (System) in EF Core, but I would like to create constants for the size of the characters, because when I map the class, I would just change the value of the constant and it would change in all places in the system. I just do...
asked by 22.09.2017 / 12:09
1
answer

WebApi URL Path

I have a Rest service in WebApi, generated the controllers by the wizard that defined the answers in "api / {controller} / {id}", as the example of get by id: // GET: api/pessoas/5 [ResponseType(typeof(pessoa))] public IHttpAc...
asked by 30.06.2017 / 12:41
2
answers

Entity Framework - Rename ForeignKey

I have the classes: [Table("Editora")] public class Editora { [Key] public int EditoraID { get; set; } public string nome { get; set; } public List<Livro> livros { get; set; } public Lis...
asked by 13.06.2017 / 01:07
1
answer

Increase the "text box" of the / Editor in Xamarin Forms

Save people! You would know how I can do to increase the text space in the Editor /> "in Xamarin Forms? In the same way that we can increase an input /> in HTML with padding? Thanks for any attempt." I would like it to be as large as the imag...
asked by 14.06.2017 / 07:59
1
answer

Error in FK when running Migrations in C #

I have the following scenario public class branch() { public Branch() { Branchs = new HashSet<Branch>(); } [StringLength(80)] public string Description { get; set; } [Required] [ForeignKey("TypeDeliv...
asked by 19.06.2017 / 18:58
1
answer

The input string was not in a correct format

When calling the method below comes the message    the input string was not in a correct format private void SubmitData() { try { string user = usuario.Text; string pass = sen...
asked by 15.06.2017 / 15:43
2
answers

Pull information last information that will use to make comparison

I have a question in SQL, what I want is that the code pulls the last information from this column and compares with a label on my site, but I do not know if the Last Insert Id is better or correct to use. > SELECT Km_Atual FROM Rota WHERE Km_A...
asked by 12.06.2017 / 20:56
2
answers

Send data to an ActionResult from a Controller other than the current one

How to make a post sending data to a ActionResult of a Controller different from the current%? Example: I have a link called lnkEnviarDados and I need to make a post on the page by sending the contents of the vari...
asked by 11.06.2017 / 15:17
1
answer

How to put only the class name in comboBox?

When adding an object in a comboBox and checking it, the full name of the class is displayed according to Microsoft conventions: NomeDaEmpresa.NomeDoProjeto.ModuloDoSistema . How do I make only the class name appear?     
asked by 11.06.2017 / 08:38
2
answers

How can I access the database directly from my model class in an ASP.NET Core project?

In ASP.NET Core Mvc I get access to DbContext on the Controller through the _context property represented by my MvcNotaContext class see: private readonly MvcNotaContext _context; This way I can search the database in the cont...
asked by 20.11.2017 / 16:59