I need to show in a View (Web form) a property of the Data Model that comes from a DB and that after performing the Submit, the Controller's action does not perform the Update on those fields in the DB but with the rest of properties of the Model.
I've tried with the [Bind(Exclude="prop1, pro2")]
and it does not work, I update the values to NULL.
I need the update on those fields in the database not to be carried out since a process in the background can modify those values and then they would be 'crushed'.
Is there a way to update only the fields I need and not all?
EDIT
I use MVC v5 and EntityFramework v6.
I think the solution would be to use the DbContext.Entry(model).Property(x => x.property).IsModified = false;
method.
The problem is that I have detected that I am using a DbContext
'private', derived from the original EntityFramework and the use of this method Entry
is not implemented: (
I'll have to ignore that problem and update the fields since you can not modify the DbContext
'private'.
Thank you.