Пример #1
0
        public MovieListResult FetchMovieList(string url)
        {
            MovieListResult result = null;

            using (var client = new HttpClient())
            {
                var response = client.GetAsync(url).Result;
                var content  = response.Content.ReadAsStringAsync().Result;
                result = Newtonsoft.Json.JsonConvert.DeserializeObject <MovieListResult>(content);
            }
            return(result);
        }
Пример #2
0
        public MovieListResult SearchMovies(string query)
        {
            MovieListResult result = null;

            using (var client = new HttpClient())
            {
                string url      = $"{searchUrl}?{apiKeyValue}&language=en-US&query={query}";
                var    response = client.GetAsync(url).Result;
                var    content  = response.Content.ReadAsStringAsync().Result;
                result = Newtonsoft.Json.JsonConvert.DeserializeObject <MovieListResult>(content);
            }
            return(result);
        }
Пример #3
0
        public void LoadData()
        {
            MovieService movieService = new MovieService();
            TVService    tVService    = new TVService();

            MovieListResult  movieListResult  = movieService.GetPopularMovies(1);
            TVShowListResult tVShowListResult = tVService.GetOnTheAirTVShows(1);

            List <Movie>  movieList  = movieListResult.results;
            List <TVShow> tVShowList = tVShowListResult.results;

            movies[0] = movieList.ElementAt <Movie>(0);
            movies[1] = movieList.ElementAt <Movie>(1);
            movies[2] = movieList.ElementAt <Movie>(2);

            tVShows[0] = tVShowList.ElementAt <TVShow>(0);
            tVShows[1] = tVShowList.ElementAt <TVShow>(1);
            tVShows[2] = tVShowList.ElementAt <TVShow>(2);
            test       = "This is not for testing";
        }