Exemple #1
0
        public async Task <IActionResult> Get([FromQuery] BaseMovieRequest movieRequest)
        {
            var movie = await _movieClient.GetMovieAsync(
                new BaseMovieViewModel
            {
                Id       = movieRequest.Id,
                Language = LanguageType.English
            });

            return(Ok(movie));
        }
Exemple #2
0
        public async Task <Movie> GetRandomMovieAsync(RandomMovieViewModel randomMovieViewModel)
        {
            // Random movie per one page
            int randomMovie = new System.Random().Next(1, 20);

            // Get short information about movies
            var movies = await _findService.GetPopularMoviesByGenreWithYearAsync(new MovieViewModel
            {
                Genre    = randomMovieViewModel.Genre,
                Language = randomMovieViewModel.Language,
                Year     = randomMovieViewModel.Year
            });

            // Get random movie
            var shortFindedMovie = movies.ElementAtOrDefault(randomMovie);

            // Get full information of movie
            return(await _movieClient.GetMovieAsync(new BaseMovieViewModel
            {
                Id = shortFindedMovie.Id,
                Language = randomMovieViewModel.Language
            }));
        }
 public async Task <MovieModel> GetMovieAsync(string id)
 {
     return(await _movieClient.GetMovieAsync(id));
 }