I have seen the related question here:
But, I have not already loaded my entity (UserView.Employee) from the context anywhere, as you can see in the code snippet below.
public ActionResult EditEmployee(UserViewDetailsModel UserView)
{
UserView.Employee.Contact = db.Contacts.Find(UserView.Employee.Contact.ContactID);
UserView.Employee.Manager = db.Employees.Find(UserView.ManagerID);
db.Entry(UserView.Employee).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
Please tell me, how can I save the changes in this case ?