Пример #1
0
        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();
            }
        }
Пример #2
0
 public DetailsModel(BonFromageContext context)
 {
     _context = context;
 }
Пример #3
0
 public CreateModel(BonFromageContext context)
 {
     _context = context;
 }
Пример #4
0
 public EditModel(BonFromageContext context)
 {
     _context = context;
 }
Пример #5
0
 public IndexModel(BonFromageContext context)
 {
     _context = context;
 }
Пример #6
0
 public DeleteModel(BonFromageContext context)
 {
     _context = context;
 }