private static async Task GetMoviesByGenre(MovieGateway movieGateway) { Console.WriteLine("\r\nGetMoviesByGenre\r\n"); var movies = await movieGateway.GetMoviesByGenre(Genre.SciFi); PrintMovies(movies); Console.WriteLine("\r\n___________________________________________\r\n"); }
private static async Task GetAllMovies(MovieGateway movieGateway) { Console.WriteLine("\r\nGetAllMovies\r\n"); var movies = await movieGateway.GetAllMovies(); PrintMovies(movies); Console.WriteLine("\r\n___________________________________________\r\n"); }
private static async Task GetAllMoviesStream(MovieGateway movieGateway) { Console.WriteLine("\r\nGetAllMoviesStream\r\n"); var asyncEnumerableMovies = movieGateway.GetAllMoviesStream(); await PrintMovies(asyncEnumerableMovies); Console.WriteLine("\r\n___________________________________________\r\n"); }
static async Task Main(string[] args) { using var movieGateway = new MovieGateway(); await GetAllMovies(movieGateway); await GetAllMoviesStream(movieGateway); await GetMoviesByGenre(movieGateway); await CreateMovie(movieGateway); Console.ReadKey(); }
private static async Task CreateMovie(MovieGateway movieGateway) { Console.WriteLine("\r\nCreateMovie\r\n"); var newGuid = Guid.NewGuid().ToString("N"); var id = await movieGateway.CreateMovie( new Movie( title : $"Title_{newGuid}", imageUrl : $"http://www.fromgrpc.com/images/{newGuid}", genre : Genre.Drama, year : 2021)); Console.WriteLine($"Id for newly created Movie: {id}"); Console.WriteLine("\r\n___________________________________________\r\n"); }
// Scrapper scrapper = new Scrapper(); // GET: Cinemas public MoviesController() { movieGateway = new MovieGateway(); ViewBag.MovieOrderByDropDownItems = movieGateway.GetMovieOrderByNames(); }