public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BonFromageContext( serviceProvider.GetRequiredService < DbContextOptions <BonFromageContext> >())) { // Look for any movies. if (context.MenuItem.Any()) { return; // DB has been seeded } context.MenuItem.AddRange( new MenuItem { Title = "When Harry Met Sally", ShortDescription = "Sallad", LongDescription = "Gurka och tomater", ImageUrl = "", SellingPrice = 20, ProductionPrice = 10 }, new MenuItem { Title = "When Harry Met Sally", ShortDescription = "Sallad", LongDescription = "Gurka och tomater", ImageUrl = "", SellingPrice = 20, ProductionPrice = 10 }, new MenuItem { Title = "When Harry Met Sally", ShortDescription = "Sallad", LongDescription = "Gurka och tomater", ImageUrl = "", SellingPrice = 20, ProductionPrice = 10 }, new MenuItem { Title = "When Harry Met Sally", ShortDescription = "Sallad", LongDescription = "Gurka och tomater", ImageUrl = "", SellingPrice = 20, ProductionPrice = 100 } ); context.SaveChanges(); } }
public DetailsModel(BonFromageContext context) { _context = context; }
public CreateModel(BonFromageContext context) { _context = context; }
public EditModel(BonFromageContext context) { _context = context; }
public IndexModel(BonFromageContext context) { _context = context; }
public DeleteModel(BonFromageContext context) { _context = context; }