Ejemplo n.º 1
0
        public ActionResult EditMovie(int id)
        {
            MovieAddEditModel model = new MovieAddEditModel();

            model.Movie     = MovieBL.GetMovie(id);
            model.MovieName = MovieNameBL.GetAllDOByMovieID(id).SingleOrDefault(q => q.IsDefault == true);
            //model.MovieArchive = MovieArchiveBL.GetAllDOByMovieID(id).SingleOrDefault();

            model.Languages.ToList().ForEach(q => q.Selected = false);
            model.Languages.Single(q => q.Value == model.MovieName.LanguageID.ToString()).Selected = true;

            //if (model.MovieArchive != null)
            //{
            //    model.ArchiveExists = true;

            //    model.ResolutionList.ToList().ForEach(q => q.Selected = false);
            //    model.ResolutionList.Single(q => q.Value == model.MovieArchive.Resolution).Selected = true;

            //    model.FileExtensionList.ToList().ForEach(q => q.Selected = false);
            //    model.FileExtensionList.Single(q => q.Value == model.MovieArchive.FileExtension).Selected = true;

            //    model.Archives.ToList().ForEach(q => q.Selected = false);
            //    model.Archives.Single(q => q.Value == model.MovieArchive.ArchiveID.ToString()).Selected = true;
            //}

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult EditMovie(MovieAddEditModel model)
        {
            int movieId = model.MovieId;

            MovieDO     _movie     = MovieBL.GetMovie(movieId);
            MovieNameDO _movieName = MovieNameBL.GetAllDOByMovieID(movieId).SingleOrDefault(q => q.IsDefault == true);

            //MovieArchiveDO _movieArchive = MovieArchiveBL.GetAllDOByMovieID(movieId).SingleOrDefault();
            //if (_movieArchive == null) _movieArchive = new MovieArchiveDO() { MovieID = movieId };

            _movieName.LanguageID = ParseHelper.ToInt32(model.NameLanguageID);
            _movieName.Name       = model.MovieName.Name;

            //_movieArchive.ArchiveID = Parse.ToInt32(model.ArchiveID);
            //_movieArchive.Resolution = model.ArchiveResolution;
            //_movieArchive.FileExtension = model.ArchiveFileExtension;
            //_movieArchive.Path = model.MovieArchive.Path;

            //if imdbid is changed, we need to reset imdb things first.
            string previousImdbId = _movie.ImdbID;

            if (string.IsNullOrEmpty(previousImdbId) == false && model.Movie.ImdbID != previousImdbId)
            {
                MovieBL.ResetImdbInformation(model.MovieId);
                _movie        = MovieBL.GetMovie(movieId);
                _movie.ImdbID = model.Movie.ImdbID;
            }

            //save movie
            MovieBL.Save(_movie, UserID);
            //save the name
            MovieNameBL.Save(_movieName, UserID);
            //if (model.ArchiveExists == true)
            //{
            //    //save the archive
            //    MovieArchiveBL.Save(_movieArchive, UserID);
            //}

            switch (model.Submit)
            {
            case "SubmitAndNavigateToMovie":
                return(RedirectToAction("DetailView", "Movie", new { id = movieId }));

            case "SubmitAndClearForm":
            default:
                return(RedirectToAction("AddMovie"));
            }
        }