public ActionResult Edit(MovieViewModel movie) { if (ModelState.IsValid) { movie.OwnerId = Guid.Parse(User.Identity.GetUserId()); _movieService.AddOrUpdate(_mapper.Map <MovieModel>(movie)); return(RedirectToAction("Index")); } ModelState.AddModelError("", ""); return(View(movie)); }
public ActionResult Edit(AddMovieViewModel model) { var movie = _mapper.Map <MovieModel>(model); movie.Poster = new MediaModel { Link = model.PosterLink, Type = MediaType.Poster }; if (model.SelectedGenres != null) { movie.Genres = _genreService.GetByIds(model.SelectedGenres); } if (model.SelectedActors != null) { movie.Actors = _actorService.GetByIds(model.SelectedActors); } _movieService.AddOrUpdate(movie, model.SelectedGenres, model.SelectedActors); return(RedirectToAction("Index", "Movie")); }