Esempio n. 1
0
 public ActionResult Create(Movie newMovie)
 {
     if (ModelState.IsValid)
     {
         db.Movies.Add(newMovie);
         db.SaveChanges();
         return RedirectToAction(_Index);
     }
     else
     {
         return View(newMovie);
     }
 }
Esempio n. 2
0
        public ActionResult Edit(Movie model)
        {
            try
            {
                var movie = db.Movies.Find(model.ID);

                UpdateModel(movie);
                db.SaveChanges();
                return RedirectToAction("Details", new { id = model.ID });
            }
            catch (Exception)
            {
                ModelState.AddModelError("", "Edit Failure, see inner exception");
            }

            return View(model);
        }