public ActionResult Add() { var addedMoviewModel = new AddMoviewViewModel { Genre = _context.Genres.ToList() }; return(View(addedMoviewModel)); }
public ActionResult Add(Movie movie) { if (ModelState.IsValid) { _context.Movies.Add(movie); _context.SaveChanges(); } else { var addedMoviewModel = new AddMoviewViewModel { Genre = _context.Genres.ToList() }; return(View(addedMoviewModel)); } return(RedirectToAction("Index", "Movie")); }