public ActionResult Delete(Actor actorToDelete) { if (ModelState.IsValid) { using (var db = new MovieDBContext()) { db.Entry(actorToDelete).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } return RedirectToAction("Index"); } return View(actorToDelete); }
public ActionResult Edit(Actor actorToUpdate) { if (ModelState.IsValid) { using (var db = new MovieDBContext()) { db.Entry(actorToUpdate).State = EntityState.Modified; db.SaveChanges(); } return RedirectToAction("Index"); } return View(actorToUpdate); }