How do I override the db.SaveChanges method that MVC scaffolding built?
Posted on 2012-08-20
I'm new to MVC. I built a model and let MVC do scaffolding. It works great, but I need to know how to override the @Html.EditorFor(model => model.PROPERTY) behavior...
For instance, I created a dropdown on my Edit page, like so:
Album: @Html.DropDownList("ddAlbum", @Model.Album)
Where the MVC scaffolding had:
@Html.EditorFor(model => model.Album)
How do I save the value from my dropdownlist to save in the db.SaveChanges() method? In the following scaffolded code:
db.Entry(song).State = EntityState.Modified;