public IActionResult GetMovieLocations(PageParameters pageParameters) { if (!_context.ListsMovieLocations.Any()) { var movieLocations = new MovieLocations { Id = 1, Title = "Zodiac", ReleaseYear = 2007, Locations = "SF Chronicle Building (901 Mission St)", FunFacts = "", ProductionCompany = "Paramount Pictures", Distributor = "Paramount Pictures" , Director = "David Fincher", Writer = "James Vanderbilt", Actor1 = "Jake Gyllenhaal", Actor2 = "Mark Ruffalo", Actor3 = "", }; _context.ListsMovieLocations.Add(movieLocations); var movieLocations1 = new MovieLocations { Id = 2, Title = "Yours, Mine and Ours", ReleaseYear = 1968, FunFacts = "", ProductionCompany = "Desilu Productions", Distributor = "United Artists", Director = "Melville Shavelson", Writer = "Bob Carroll, Jr.", Actor1 = "Lucille Ball", Actor2 = "Henry Fonda", Actor3 = "Van Johnson" }; _context.ListsMovieLocations.Add(movieLocations1); _context.SaveChangesAsync(); } var results = _movieLocationsQueries.GetMovieLocationsAsync(pageParameters); return(Ok(results)); }
private void SeedAndCacheDataWhenFirstRequestComes() { if (!_context.ListsMovieLocations.Any()) { var movieLocations = new Maersk.Movies.Domain.Models.MovieLocation { Id = 1, Title = "Zodiac", ReleaseYear = 2007, Locations = "SF Chronicle Building (901 Mission St)", FunFacts = "", ProductionCompany = "Paramount Pictures", Distributor = "Paramount Pictures", Director = "David Fincher", Writer = "James Vanderbilt", Actor1 = "Jake Gyllenhaal", Actor2 = "Mark Ruffalo", Actor3 = "", }; _context.ListsMovieLocations.Add(movieLocations); var movieLocations1 = new Maersk.Movies.Domain.Models.MovieLocation { Id = 2, Title = "Yours, Mine and Ours", ReleaseYear = 1968, FunFacts = "", Locations = "", ProductionCompany = "Desilu Productions", Distributor = "United Artists", Director = "Melville Shavelson", Writer = "Bob Carroll, Jr.", Actor1 = "Lucille Ball", Actor2 = "Henry Fonda", Actor3 = "Van Johnson" }; _context.ListsMovieLocations.Add(movieLocations1); var movieLocations3 = new Maersk.Movies.Domain.Models.MovieLocation { Id = 3, Title = "180", ReleaseYear = 2011, FunFacts = "", Locations = "Epic Roasthouse (399 Embarcadero)", ProductionCompany = "SPI Cinemas", Distributor = "United Artists", Director = "Jayendra", Writer = "Umarji Anuradha", Actor1 = "Siddarth", Actor2 = "Nithya Menon", Actor3 = "Priya Anand" }; _context.ListsMovieLocations.Add(movieLocations3); var movieLocations4 = new Maersk.Movies.Domain.Models.MovieLocation { Id = 4, Title = "180", ReleaseYear = 2011, FunFacts = "", Locations = "City Hall", ProductionCompany = "SPI Cinemas", Distributor = "United Artists", Director = "Jayendra", Writer = "Umarji Anuradha", Actor1 = "Siddarth", Actor2 = "Nithya Menon", Actor3 = "Priya Anand" }; _context.ListsMovieLocations.Add(movieLocations4); var movieLocations5 = new Maersk.Movies.Domain.Models.MovieLocation { Id = 5, Title = "180", ReleaseYear = 2011, FunFacts = "", Locations = "Polk & Larkin Streets", ProductionCompany = "SPI Cinemas", Distributor = "United Artists", Director = "Jayendra", Writer = "Umarji Anuradha", Actor1 = "Siddarth", Actor2 = "Nithya Menon", Actor3 = "Priya Anand" }; _context.ListsMovieLocations.Add(movieLocations5); _context.SaveChangesAsync(); } }