Пример #1
0
        public static List <MovieNameDO> GetAllDOByMovieID(int movieID)
        {
            List <MovieNameDO> names = new List <MovieNameDO>( );

            foreach (var item in GetAllByMovieID(movieID).OrderByDescending(n => n.IsDefault).ThenBy(n => n.Name))
            {
                MovieNameDO newItem = Mapper.Map <vMovieName, MovieNameDO>(item);
                newItem.LanguageName = item.LanguageName;
                names.Add(newItem);
            }
            return(names);
        }
Пример #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"));
            }
        }
Пример #3
0
        public static void Save(MovieNameDO dataObj, int userID)
        {
            Repository <MOV_M_Name> rep = new Repository <MOV_M_Name>(MArchiveDataContextProvider.Instance);

            MOV_M_Name objectToAdd = null;

            if (dataObj.ID == 0)
            {
                objectToAdd = new MOV_M_Name( );
                ObjectMapper.MapObjects(dataObj, objectToAdd, AuditInfo.Fields);
                rep.InsertOnSubmit(objectToAdd);
            }
            else
            {
                objectToAdd = rep.GetAll( ).Single(x => x.ID == dataObj.ID);
                ObjectMapper.MapObjects(dataObj, objectToAdd, AuditInfo.Fields);
            }
            rep.DCP.CommitChanges(userID);

            InvalidateCache(CacheAreaKey);

            ObjectMapper.MapObjects(objectToAdd, dataObj);
        }