This is the current basic code :
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(Registration registration)
{
if (Mode
Try this
if (ModelState.IsValid)
{
db.Entry(registration).State = EntityState.Modified;
db.Entry(registration).Property(x => x.Name).IsModified = false; //Add fields which you don't want to modify
db.SaveChanges();
return RedirectToAction("Index");
}
Update : as per answer in this post
var excluded = new[] { "property1", "property2" };
var entry = context.Entry(obj);
entry.State = EntityState.Modified;
foreach (var name in excluded)
{
entry.Property(name).IsModified = false;
}