Esempio n. 1
0
        public ActionResult AddMovie(MovieAddEditModel model)
        {
            model.MovieName.LanguageID = ParseHelper.ToInt32(model.NameLanguageID);
            model.MovieName.IsDefault  = true;

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

            //insert movie first and get inserted id
            int movieId = MovieBL.Save(model.Movie, UserID);

            //save the name
            model.MovieName.MovieID = movieId;
            MovieNameBL.Save(model.MovieName, UserID);
            //if (model.ArchiveExists == true)
            //{
            //    //save the archive
            //    model.MovieArchive.MovieID = movieId;
            //    MovieArchiveBL.Save(model.MovieArchive, UserID);
            //}

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

            case "SubmitAndClearForm":
            default:
                return(RedirectToAction("AddMovie"));
            }
        }
Esempio 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"));
            }
        }