예제 #1
0
 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);
 }
예제 #2
0
 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);
 }