public static void Initialize(IServiceProvider serviceProvider) { using (var context = new RetroGamesContext( serviceProvider.GetRequiredService < DbContextOptions <RetroGamesContext> >())) { // Look for any movies. if (context.Item.Any()) { return; // DB has been seeded } context.Item.AddRange( new Item { ItemName = "The Legend of Zelda: Ocarina of Time", Company = "Nintendo", Platform = "Nintendo 64", Price = 15.99M, Rating = "E" }, new Item { ItemName = "Kingdom Hearts", Company = "Square Enix", Platform = "PlayStation 2", Price = 14.99M, Rating = "E" }, new Item { ItemName = "PlayStation", Company = "Sony", Platform = "PlayStation", Price = 19.99M, Rating = "N/A" }, new Item { ItemName = "Crazy Taxi", Company = "Sega", Platform = "Dreamcast", Price = 8.99M, Rating = "E" } ); context.SaveChanges(); } }
public DetailsModel(SmallRazorWebPage.Models.RetroGamesContext context) { _context = context; }
public IndexModel(SmallRazorWebPage.Models.RetroGamesContext context) { _context = context; }