Questions tagged as 'asp.net-mvc'

1
answer

Pass value of equal properties, different classes

I need the following I do not know if it has how to do, So the question, I have two classes and in these two classes I have exactly the same properties, public class Cliente { public int ID { get; set; } public string FisicaJuridica {...
asked by 10.02.2017 / 05:23
4
answers

ASP.NET MVC input number

I'm trying to use a input with type=number , however in Chrome you're giving the value you entered should be a number. The problem is in the model state that is returning invalid, because when giving the post, it is entering Crea...
asked by 19.07.2016 / 15:43
2
answers

Calling an AccountController function

I'm trying to fetch the logged-in user ID like this: public int CurrentUserID() { return Convert.ToInt32(User.Identity.GetUserId()); } This method is in AccountController and I want to call it from any other controlle...
asked by 14.12.2016 / 14:21
3
answers

Compare string with enum, within lambda?

The problem is: I have a dropdownlist loaded from an enum, which may come with the null value of the screen. listaItensSolicitados = os.Site == null ? this.itemSolicitadoService.Consultar(o => o.ItemServico.Servico.Chave...
asked by 09.12.2016 / 15:53
1
answer

What is the reference for HttpContext.GetOwinContext ()?

I needed to abstract the Controllers of an application ASP.NET MVC to a Class Library because I'm using different technologies in the same application. However, I have the error:    'System.Web.HttpContextBase' does no...
asked by 12.12.2016 / 21:06
1
answer

How to configure Context to put the plural table name in pt-BR?

I'm in an ASP.NET MVC 5 application, setting up a DbContext class. When EF generates the database, the tables for the application objects are getting the plural names in English. For example: public System.Data.Entity.DbSet<Teste....
asked by 15.07.2016 / 18:39
2
answers

Change color of an Error Message using Annotation

Where can I change the color of this ErrorMessage ?     
asked by 07.10.2016 / 01:03
1
answer

Entity FrameWork (ORM) and DropDownList Html

I have two mapped models that will work like this: The model Afaze will have a ComboBox (DropDownList) that will make the categories available to the user to select, however these categories are registered by the same, so in the source I h...
asked by 24.09.2016 / 00:42
1
answer

How to create a method that takes only one string parameter and returns a generic type? .NET MVC

How could I create a method that does not need to receive a type as a parameter, only a string , but would return a type? As for example: public static T Guard(string guard_name) where T : class, IAuth { return (T)Activator.Create...
asked by 30.06.2016 / 15:19
1
answer

How to change web.config when running Deploy?

I have an approval and a production environment in the cloud, but I deploy Deploy in File System . I have to insert some parameters and change the connectionString for each of these environments. Parameter examples: Information...
asked by 06.01.2016 / 22:03