Example #1
0
        public ActionResult MovieEdit(MovieEditViewModel viewModel, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                int?directorId = null;
                if (int.TryParse(collection[CreateFilmViewModel.DirectorCollectionKey], out var dt))
                {
                    directorId = dt;
                }
                _movieService.EditMovie(FilmViewerMapper.Mapper.Map <MovieDetailsDto>(viewModel),
                                        ManagerHelper.CategoryCommaCollectionRefactor(collection[CreateFilmViewModel.ActorCollectionKey]),
                                        directorId,
                                        ManagerHelper.CategoryCommaCollectionRefactor(collection[CreateFilmViewModel.MetadataCollectionKey]),
                                        ManagerHelper.CategoryCommaCollectionRefactor(collection[CreateFilmViewModel.CategoryCollectionKey])
                                        );
                TempData[UserMessages.UserMessage] = new MessageViewModel()
                {
                    CssClass = "alert-success",
                    Message  = Resources.MovieEditedSuccesfully
                };

                return(RedirectToAction("MovieView"));
            }
            return(RedirectToAction("MovieEdit", new { id = viewModel.MovieId }));
        }
Example #2
0
 public ActionResult CreateFilm(CreateFilmViewModel viewModel, FormCollection collection)
 {
     if (ModelState.IsValid)
     {
         int?directorId = null;
         if (int.TryParse(collection[CreateFilmViewModel.DirectorCollectionKey], out var dt))
         {
             directorId = dt;
         }
         var movieId = _movieService.AddMovie(FilmViewerMapper.Mapper.Map <MovieDetailsDto>(viewModel),
                                              ManagerHelper.CategoryCommaCollectionRefactor(collection[CreateFilmViewModel.ActorCollectionKey]),
                                              directorId,
                                              ManagerHelper.CategoryCommaCollectionRefactor(collection[CreateFilmViewModel.MetadataCollectionKey]),
                                              ManagerHelper.CategoryCommaCollectionRefactor(collection[CreateFilmViewModel.CategoryCollectionKey]),
                                              Server.MapPath(FolderPaths.UploadPath),
                                              FolderPaths.UploadPath
                                              );
         return(RedirectToAction("AddPhotoToFilm", new { id = movieId }));
     }
     return(View(viewModel));
 }