예제 #1
0
 public ActionResult Create([Bind(Include = "MovieId,Title,ReleaseDate,Genre,Price")] Movies movie)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _moviesAppServices.Insert(movie);
             _moviesAppServices.Save();
             return(RedirectToAction("Index"));
         }
     }
     catch (DataException /* dex */)
     {
         //Log the error (uncomment dex variable name after DataException and add a line here to write a log.
         ModelState.AddModelError(string.Empty, "Unable to save changes. Try again, and if the problem persists contact your system administrator.");
     }
     return(View(movie));
 }