public ActionResult Create(Movie movie) { if (ModelState.IsValid) { _movieRepository.Add(movie); Success("Your movie has been added."); return RedirectToAction("Index"); } ViewBag.PossibleDirectors = _personRepository.Get(); return View(movie); }
public ActionResult Edit(Movie movie) { if (ModelState.IsValid) { _movieRepository.Update(movie); Success("Your movie was updated"); return RedirectToAction("Index"); } Error("Could not save your movie"); ViewBag.PossibleDirectors = _personRepository.Get(); return View(movie); }
// // GET: /Movies/Create public ActionResult Create() { ViewBag.PossibleDirectors = _personRepository.Get(); var movie = new Movie(); return View(movie); }
public void Update(Movie movie) { var oldMovie = Get(movie.Id); _context.Entry(oldMovie).CurrentValues.SetValues(movie); _context.SaveChanges(); }