Beispiel #1
0
        public static async void Initialize(IServiceProvider serviceProvider)
        {
            using var context = new MenuDishContext(
                      serviceProvider.GetRequiredService <
                          DbContextOptions <MenuDishContext> >());
            // Look for any movies.
            if (context.MenuDish.Any())
            {
                return;   // DB has been seeded
            }
            else
            {
                await ReadHTML();

                foreach (var item in MenuList)
                {
                    context.MenuDish.Add(item);
                    context.SaveChanges();
                }
            }
        }
Beispiel #2
0
 public HomeController(ILogger <HomeController> logger, IngredientContext context, MenuDishContext contextMenu)
 {
     _logger      = logger;
     _context     = context;
     _contextMenu = contextMenu;
 }
 public MenuDishesController(MenuDishContext context)
 {
     _context = context;
 }