示例#1
0
        /// <summary>
        /// Minority is set in the enum.Filters as per enum and returns list
        /// </summary>
        /// <param name="lstAllMovies"></param>
        /// <param name="noOfMovies"></param>
        /// <returns></returns>
        public List <MovieDetails> GetAllGenresAndFilterByMinority(List <MovieDetails> lstAllMovies, int noOfMovies)
        {
            var genreList = ExternalAPIService.GetSpecifiedListFromMovieWebAPI <GenreDBJson>(_genreConnectionKey, 0);

            List <MovieDetails> minorityGenres = new List <MovieDetails>();

            minorityGenres.AddRange(lstAllMovies.Where(x => x.genre_ids.Contains((int)MinorityGenre.Documentary) ||
                                                       x.genre_ids.Contains((int)MinorityGenre.Fantasy) ||
                                                       x.genre_ids.Contains((int)MinorityGenre.History) ||
                                                       x.genre_ids.Contains((int)MinorityGenre.Music) ||
                                                       x.genre_ids.Contains((int)MinorityGenre.ScienceFiction) ||
                                                       x.genre_ids.Contains((int)MinorityGenre.War))
                                    .Select(x => new MovieDetails
            {
                popularity        = x.popularity,
                vote_count        = x.vote_count,
                video             = x.video,
                poster_path       = x.poster_path,
                id                = x.id,
                adult             = x.adult,
                backdrop_path     = x.backdrop_path,
                original_language = x.original_language,
                original_title    = x.original_title,
                genre_ids         = x.genre_ids,
                title             = x.title,
                vote_average      = x.vote_average,
                overview          = x.overview,
                release_date      = x.release_date
            }));

            return(minorityGenres.Take(noOfMovies).ToList());
        }
示例#2
0
 /// <summary>
 /// async call to external Movie Db api API
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="pageId"></param>
 /// <returns></returns>
 private MovieDBAPI CallApi(string connection, int pageId)
 {
     return(ExternalAPIService.GetSpecifiedListFromMovieWebAPI <MovieDBAPI>(connection, pageId).GetAwaiter().GetResult());
 }