Questions tagged as 'asp.net-mvc-4'

4
answers

Dynamically check which attributes of a Model have changed?

I'm developing an ASP.NET MVC 4 application and need to save the log of every change made to a Model object. Is there any native method or implementation already known that does this? Example: public class Pessoa { public int? Id { ge...
asked by 14.08.2014 / 20:14
3
answers

Dynamic display of required, optional, or non-existent fields

There is a class that has 12 properties, which may be mandatory, optional or non-existent depending on the business rule specified in the registration of another class. How would I be able to compile a View that displays only the requi...
asked by 24.03.2014 / 14:22
2
answers

Fluent API relationship questions for EF 5

I have two classes: User > Contains your PK (ID). UsuarioP > Contains user ID (FK). Class User.cs public Usuario() { this.UsuariosP = new List<UsuarioP>(); } public int Id { get; set; } (...) public virtual ICo...
asked by 28.09.2015 / 15:21
2
answers

How do I know the name of ActionResult that called the view?

I wonder if it's possible to get the name of ActionResult that called View . I know that View normally has the same name as ActionResult , but in my case, I have a single view for two ActionResult different, henc...
asked by 28.06.2014 / 16:21
1
answer

How to use session for authentication in MVC 4 with C #?

My scenario is as follows. I have an MVC 4 application. On my controller I check the logged in user and password. (I think) I put user data in a session after the data is verified and correct. My pages are cshtml (Razor). And I have a master...
asked by 02.07.2014 / 23:50
2
answers

Progress bar on file upload and information registry

I'm developing a project, where I use upload files, as well as an information registry. Both the file and the information are registered in the same form. So far so good, but it's usually that when there is a larger file, it takes about 20 to 30...
asked by 25.07.2015 / 21:23
3
answers

Encapsulate values returned by JSON within a single object

I have a question, I have this code below in controller : [Authorize] public JsonResult Teste() { var licencas = new List<Object>(); licencas.Add(new { Responsavel = "José",...
asked by 18.03.2014 / 19:28
1
answer

How to use Format: Webgrid?

I'm developing with MVC, and I have the view list [...] var columns = new WebGridColumn[] { grid.Column("Id"), grid.Column("Descricao"), grid.Column("UsuarioModificacao"), grid.Column("DataModificacao"),...
asked by 30.12.2014 / 13:17
3
answers

Error in controller ViewData

What could be wrong with this example? I can not do this: var pessoa = new Pessoa ( PessoaId = 1, Nome = "teste teste", twitter = "@teste" ); Error message:    'Name' does not exis...
asked by 30.09.2014 / 16:48
3
answers

Capturing the user's real IP

How do I capture the real IP / Public IP of the user who is accessing the application? The IP of the computer I can capture normally, but I want to know the public IP of that client.     
asked by 03.09.2015 / 22:23