Example #1
0
        public int AddMovie(MovieDetailsDto movieDetails, List <int> actorsIds, int?directorId, List <int> metadataIds,
                            List <int> categoryIds, string serverPath, string virtualPath)
        {
            var movie = new Movie();

            _movieFactory.SetValuesByMovieDetailsDto(movie, movieDetails);
            if (directorId.HasValue)
            {
                _movieFactory.SetDirector(movie, directorId.Value);
            }
            if (actorsIds != null && actorsIds.Any())
            {
                _movieFactory.SetActors(movie, actorsIds);
            }
            if (categoryIds != null && categoryIds.Any())
            {
                _movieFactory.SetCategories(movie, categoryIds);
            }
            _movieFactory.SetMetadata(movie, metadataIds);
            movie.Folder = _directoryFactory.CreateDirectoryForMovie(serverPath, movie.TitleEng, virtualPath);

            _uow.MovieRepository.Add(movie);

            _uow.Complete();

            return(movie.Id);
        }
Example #2
0
        public int AddDirector(DirectorDetailsDto directorDto, string serverPath, string virtualPath)
        {
            var director = BusinessMapper.Mapper.Map <Director>(directorDto);

            director.Folder = _directoryFactory.CreateDirectoryForMovie(serverPath, director.Name, virtualPath);
            _uow.DirectorRepository.Add(director);
            _uow.Complete();

            return(director.Id);
        }