public async Task <ActionResult> GetCombined(string order) { List <Movie> moviesCombined = await GetCombineMoviesList(); var moviesCombinedOrderedByRating = OrderMoviesByRating(moviesCombined, order); var movieTitleVisitor = new MovieTitleVisitor(); var listOfMovieTitlesCombined = movieTitleVisitor.GetListOfMovieTitles(moviesCombinedOrderedByRating); return(Ok(listOfMovieTitlesCombined)); }
public async Task <IActionResult> GetToplist(string order) { var url = "https://ithstenta2020.s3.eu-north-1.amazonaws.com/topp100.json"; var client = clientFactory.CreateClient(); var response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { var result = await client.GetStringAsync(url); var movies = JsonSerializer.Deserialize <List <Movie> >(result, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }); var moviesOrderedByRating = OrderMoviesByRating(movies, order); var movieTitleVisitor = new MovieTitleVisitor(); var listOfMovieTitles = movieTitleVisitor.GetListOfMovieTitles(moviesOrderedByRating); return(Ok(listOfMovieTitles)); } return(NotFound()); }