Ejemplo n.º 1
0
        //get info of this cast only
        public async Task <CastResponseModel> GetById(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            return(new CastResponseModel {
                Id = cast.Id, Name = cast.Name, Gender = cast.Gender, TmdbUrl = cast.TmdbUrl, ProfilePath = cast.ProfilePath
            });
        }
Ejemplo n.º 2
0
        public async Task <CastDetailsResponseModel> GetCastDetailsWithMovies(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            var respose = new CastDetailsResponseModel {
                Id          = cast.Id, Name = cast.Name, Gender = cast.Gender,
                ProfilePath = cast.ProfilePath, TmdbUrl = cast.TmdbUrl
            };

            var castMovies = new List <MovieResponseModel>();


            foreach (var m in cast.MovieCasts)
            {
                var movieResponse = new MovieResponseModel {
                    Id          = m.Movie.Id, Title = m.Movie.Title, PosterUrl = m.Movie.PosterUrl,
                    ReleaseDate = m.Movie.ReleaseDate.Value
                };

                castMovies.Add(movieResponse);
            }

            respose.Movies = castMovies;

            return(respose);
        }
Ejemplo n.º 3
0
        public async Task <CastDetailsResponseModel> GetCastDetailsWithMovies(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            if (cast == null)
            {
                throw new NotFoundException("Cast", id);
            }
            var movies = new List <MovieResponseModel>();

            foreach (var thing in cast.MovieCasts)
            {
                movies.Add(new MovieResponseModel
                {
                    Id          = thing.MovieId,
                    PosterUrl   = thing.Movie.PosterUrl,
                    ReleaseDate = (DateTime)thing.Movie.ReleaseDate,
                    Title       = thing.Movie.Title
                });
            }
            var response = new CastDetailsResponseModel {
                Id          = cast.Id,
                Name        = cast.Name,
                Gender      = cast.Gender,
                TmdbUrl     = cast.TmdbUrl,
                ProfilePath = cast.ProfilePath,
                Movies      = movies
            };

            return(response);
        }
Ejemplo n.º 4
0
        public async Task <CastDetailsResponseModel> GetCastAsync(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            var castResult = new CastDetailsResponseModel();


            castResult.Name        = cast.Name;
            castResult.Gender      = cast.Gender;
            castResult.TmdbUrl     = cast.TmdbUrl;
            castResult.ProfilePath = cast.ProfilePath;
            castResult.Id          = cast.Id;
            castResult.CastId      = cast.Id;

            castResult.MovieId = new List <MovieDetailsResponseModel>();

            castResult.Movie = new List <MovieDetailsResponseModel>();


            foreach (var movieCast in cast.MovieCast)
            {
                castResult.Movie.Add(
                    new MovieDetailsResponseModel
                {
                    Title     = movieCast.Movie.Title,
                    PosterUrl = movieCast.Movie.PosterUrl,
                    Overview  = movieCast.Movie.Overview,
                    Id        = movieCast.Movie.Id
                });
            }

            return(castResult);
        }
Ejemplo n.º 5
0
        public async Task <Cast> GetCastDetailsWithMovies(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            //if (cast == null)
            //{
            //    throw new NotFoundException("Cast", id);
            //}

            //var response = _mapper.Map<CastDetailsResponseModel>(cast);
            return(cast);
        }
Ejemplo n.º 6
0
        public async Task <MovieCardResponseModel> GetMovieCardById(int id)
        {
            var movie = await _movieRepository.GetByIdAsync(id);

            var genreList = new List <GenreResponseModel>();

            foreach (var genre in movie.Genres)
            {
                var theGenre = await _genreRepository.GetByIdAsync(genre.Id);

                genreList.Add(new GenreResponseModel
                {
                    Id   = theGenre.Id,
                    Name = theGenre.Name,
                });
            }
            var castList = new List <CastDetailResponseModel>();

            foreach (var cast in movie.MovieCasts)
            {
                var theCast = await _castRepository.GetByIdAsync(cast.CastId);

                castList.Add(new CastDetailResponseModel
                {
                    Id          = theCast.Id,
                    Name        = theCast.Name,
                    ProfilePath = theCast.ProfilePath,
                    Character   = cast.Character,
                });
            }
            var theMovie = new MovieCardResponseModel
            {
                Id          = movie.Id,
                Budget      = movie.Budget,
                Title       = movie.Title,
                BackdropUrl = movie.BackdropUrl,
                PosterUrl   = movie.PosterUrl,
                Tagline     = movie.Tagline,
                RunTime     = movie.RunTime,
                Overview    = movie.Overview,
                Price       = movie.Price,
                ReleaseDate = movie.ReleaseDate,
                Rating      = movie.Rating,
                Revenue     = movie.Revenue,
                ImdbUrl     = movie.ImdbUrl,
                Genres      = genreList,
                Casts       = castList,
            };

            return(theMovie);
        }
Ejemplo n.º 7
0
        public async Task <CastDetailsResponseModel> GetCastDetailsWithMovies(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            var ReturnedCast = new CastDetailsResponseModel {
                Id          = cast.Id,
                Name        = cast.Name,
                Gender      = cast.Gender,
                TmdbUrl     = cast.TmdbUrl,
                ProfilePath = cast.ProfilePath
            };

            return(ReturnedCast);
        }
Ejemplo n.º 8
0
        public async Task <CastResponseModel> GetCastDetailByMovieId(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            if (cast == null)
            {
                throw new NotFoundException("Cast", id);
            }

            var response = new CastResponseModel
            {
                Id          = cast.Id,
                Name        = cast.Name,
                ProfilePath = cast.ProfilePath,
                TmdbUrl     = cast.TmdbUrl
            };

            return(response);
        }
Ejemplo n.º 9
0
        public async Task <CastDetailsResponseModel> GetCastDetailsWithMovies(int id)
        {
            var cast = await _castRepository.GetByIdAsync(id);

            if (cast == null)
            {
                return(null);
            }
            var resp = new CastDetailsResponseModel()
            {
                Id          = cast.Id,
                Gender      = cast.Gender,
                Name        = cast.Name,
                ProfilePath = cast.ProfilePath,
                TmdbUrl     = cast.TmdbUrl
            };

            return(resp);
        }
Ejemplo n.º 10
0
 public async Task <Cast> GetCastDetails(int id)
 {
     return(await _castRepository.GetByIdAsync(id));
 }