public Task <IEnumerable <Movie> > GetAllMovies() { var moviesTask = ImdbServiceGateway.GetAllMovies(); var moviesFromDbTask = DataFacade.GetAllMovies(); return(GetMoviesFromCombinedTasks(moviesTask, moviesFromDbTask)); }
private void Dispose(bool disposing) { if (disposing && !_disposed) { var tempMovieServiceGateway = _movieServiceGateway; tempMovieServiceGateway.Dispose(); _movieServiceGateway = null; _disposed = true; } }
private void Dispose(bool disposing) { if (disposing && !_disposed && _imdbServiceGateway != null) { var localImdbServiceGateway = _imdbServiceGateway; localImdbServiceGateway.Dispose(); _imdbServiceGateway = null; _disposed = true; } }
public async Task <IEnumerable <Movie> > GetMoviesByGenre(Genre genre) { GenreParser.Validate(genre); var moviesFromImdbTask = ImdbServiceGateway.GetAllMovies(); var moviesFromDbMatchingGenreTask = DataFacade.GetMovieByGenre(genre); await Task.WhenAll(moviesFromImdbTask, moviesFromDbMatchingGenreTask).ConfigureAwait(false); var moviesMatchingGenre = moviesFromDbMatchingGenreTask.Result.ToList(); moviesMatchingGenre.AddRange(moviesFromImdbTask.Result.Where(m => m.Genre == genre)); return(moviesMatchingGenre); }
public async Task <IEnumerable <Movie> > GetAllMovies() { var moviesTask = ImdbServiceGateway.GetAllMovies(); var moviesFromDbTask = DataFacade.GetAllMovies(); await Task.WhenAll(moviesTask, moviesFromDbTask).ConfigureAwait(false); var movies = moviesTask.Result; var moviesFromDb = moviesFromDbTask.Result; var moviesList = movies.ToList(); moviesList.AddRange(moviesFromDb); return(moviesList); }