コード例 #1
0
        public async Task <GetPopularMoviesResponse> Handle(GetPopularMoviesRequest request, CancellationToken cancellationToken)
        {
            var model  = new GetPopularMoviesResponse();
            var result = await _http.GetPopularMovies(request.ActorId);

            using (var stream = await result.Content.ReadAsStreamAsync())
            {
                var data = await JsonSerializer.DeserializeAsync <PopularMovies>(stream);

                foreach (var movie in data.results)
                {
                    movie.BackdropPath = movie.BackdropPath != null ? movie.BackdropPath : "https://www.themoviedb.org/assets/2/v4/glyphicons/basic/glyphicons-basic-38-picture-grey-c2ebdbb057f2a7614185931650f8cee23fa137b93812ccb132b9df511df1cfac.svg";
                }
                ;

                model.Movies = data.results;
            }

            return(model);
        }