Reputation: 3
I am currently in the process of creating an MVC application. I am trying to set it so that when an item is created, there are 4 properties gathered, DocumentID, Name, Title and CreationDate. Only two of these properties should be alterable by the user, DocumentID is automatically hidden when I created the controlled. I have hidden CreationDate from the view but I am unsure of what should be my next step.
Any help would be greatly appreciated.
Upvotes: 0
Views: 398
Reputation: 10113
The best approach would be to create view models containing only the values you need to edit. Submit the view model instead of the full entity, map the modified values onto the real entity, then persist the changes.
Upvotes: 2