public ActionResult Edit(Guid id) { var model = new MovieCreateEditViewModel() { Genres = this._genresSvc.GetGenres(), Movie = this._moviesSvc.GetMovieById(id) }; return(View(model)); }
public ActionResult Edit(MovieCreateEditViewModel model) { if (ModelState.IsValid) { this._moviesSvc.EditMovie(model.Movie); return(RedirectToAction("Index")); } model.Genres = this._genresSvc.GetGenres(); return(View(model)); }
public ActionResult Create(string movieName) { if (!string.IsNullOrEmpty(movieName)) { ViewBag.MovieName = movieName; } var model = new MovieCreateEditViewModel() { Genres = this._genresSvc.GetGenres() }; return(View(model)); }
public ActionResult Create(MovieCreateEditViewModel model, string submitCommand) { if (ModelState.IsValid) { this._moviesSvc.AddMovie(model.Movie); if (submitCommand.Equals("Save")) { return(RedirectToAction("Index", new { movieName = model.Movie.Name })); } else { return(RedirectToAction("Create", new { movieName = model.Movie.Name })); } } model.Genres = this._genresSvc.GetGenres(); return(View(model)); }
public ActionResult Create(MovieCreateEditViewModel model, string submitCommand) { //ModelState.AddModelError(string.Empty, "The movie already exists!"); if (ModelState.IsValid) { model.Movie.Id = Guid.NewGuid(); this._moviesSvc.AddMovie(model.Movie); if (submitCommand.Equals("Save")) { return(RedirectToAction("Index", new { movieName = model.Movie.Name })); } else { return(RedirectToAction("Create", new { movieName = model.Movie.Name })); } } model.Genres = this._genresSvc.GetGenres(); return(View(model)); }