public ActionResult Create(Movie movie) { if (ModelState.IsValid) { _db.Movies.Add(movie); _db.SaveChanges(); return RedirectToAction("Index"); } return View(); }
public ActionResult Edit(Movie model) { if (ModelState.IsValid) { //Don't use this it has some inherit problems //_db.Entry(movie).State = System.Data.Entity.EntityState.Modified; Movie dbMovie = _db.Movies.Find(model.Id); dbMovie.Title = model.Title; dbMovie.Director = model.Director; _db.SaveChanges(); return RedirectToAction("Index"); } return View(); }