I have the following Edit method:
[HttpPost]
public ActionResult Edit(Movie movie)
{
try
{
_db.ApplyCurrentValues("Movies1",movie);
_db.SaveChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
I get the error below when I run it:
An object with a key that matches the key of the supplied object could not be found in the ObjectStateManager. Verify that the key values of the supplied object match the key values of the object to which changes must be applied.
A couple points:
- I did not get the error the first time I did an update, only subsequent updates.
- Movies1 is the the name of the EntitySet when I view the edmx designer. Is this what it shold be or should it be the name of the table (Movie)?
- I have seen things regarding Attach, but I am confused as to what exactly that is.