public static void Initialize(IServiceProvider serviceProvider) { using (var context = new SandwichContext( serviceProvider.GetRequiredService <DbContextOptions <SandwichContext> >())) { if (context.Sandwich.Any()) { return; } context.Sandwich.AddRange( new Sandwich { Name = "BLT", Birthday = DateTime.Parse("1996-11-8"), Price = 5.00M, Rating = "Great!" }, new Sandwich { Name = "Club", Birthday = DateTime.Parse("1492-2-2"), Price = 22.22M, Rating = "Good!" } ); context.SaveChanges(); } }
public DeleteModel(WebApplication1.Models.SandwichContext context) { _context = context; }
public IndexModel(WebApplication1.Models.SandwichContext context) { _context = context; }