public ActionResult Add(AddMovieVM model) { var selectedGenres = model.Genres.Where(x => x.IsChecked).Select(x => x.ID).ToList(); MovieManager.Add(model.Title, model.ReleaseDate, model.RunningTimeMinutes, selectedGenres); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { var model = new AddMovieVM(); model.Movie = movieRepo.Get(id); return(View(model)); }
public ActionResult Add() { var model = new AddMovieVM(); model.Movie = new Movie(); return(View(model)); }
public IActionResult AddPost(AddMovieVM model) { if (model.Title == model.Description) { ModelState.AddModelError("description", "The Description cannot exactly match the Title."); } if (!ModelState.IsValid) { return(View("Add", model)); } TempData.Put("AddedMovie", model); return(RedirectToAction("Index")); }
public ActionResult Add() { AddMovieVM model = new AddMovieVM(); var allGenres = GenreManager.GetAll(); var checkBoxListItems = new List <CheckBoxListItem>(); foreach (var genre in allGenres) { checkBoxListItems.Add(new CheckBoxListItem() { ID = genre.ID, Display = genre.Name, IsChecked = false }); } model.Genres = checkBoxListItems; return(View(model)); }
public ActionResult PostMovie(AddMovieVM newMovie) { movieRepo.Insert(newMovie.Movie); return(RedirectToAction("Index", "Home")); }
public IActionResult Add() { AddMovieVM model = new AddMovieVM(); return(View(model)); }