Example #1
0
        public ActionResult Create(Movie movie)
        {
            if (ModelState.IsValid)
            {
                _db.Movies.Add(movie);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(movie);
        }
Example #2
0
 public ActionResult Edit(Movie movie)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(movie).State = EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(movie);
 }