コード例 #1
0
 public ActionResult Delete(int id, Movie movie)
 {
     try
     {
         _db.Entry(movie).State = EntityState.Deleted;
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
コード例 #2
0
 public ActionResult Create(Movie movie)
 {
     try
     {
         _db.Movies.Add(movie);
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }