public ActionResult Edit(int id) { using (var db = new TestEntities()) { return View(db.DepartmentMasters.Find(id)); } } [HttpPost] public ActionResult Edit(int id, DepartmentMaster dm) { try { using (var db = new TestEntities()) { db.Entry(dm).State = System.Data.EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } } catch { return View(); } }
public ActionResult Edit(int id)
public ActionResult Edit(int id, DepartmentMaster dm)
Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)