Exemple #1
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            AppChefDbContext context = app.ApplicationServices.GetRequiredService <AppChefDbContext>();

            context.Database.Migrate();
            if (!context.Dishes.Any())
            {
                context.Dishes.AddRange(
                    new Dish()
                {
                    Name  = "Pasta Pesto",
                    Price = 10,
                    DietaryRestrictions = 7,
                    DishCategory        = 7,
                    Description         = "Pasta Pesto",
                    ChefEmail           = "*****@*****.**"
                },
                    new Dish()
                {
                    Name  = "Pasta Carbonara",
                    Price = 10,
                    DietaryRestrictions = 7,
                    DishCategory        = 7,
                    Description         = "Pasta Carbonara",
                    ChefEmail           = "*****@*****.**"
                },
                    new Dish()
                {
                    Name  = "Noedelsoep",
                    Price = 10,
                    DietaryRestrictions = 7,
                    DishCategory        = 7,
                    Description         = "Noedelsoep",
                    ChefEmail           = "*****@*****.**"
                },
                    new Dish()
                {
                    Name  = "Couscous",
                    Price = 10,
                    DietaryRestrictions = 7,
                    DishCategory        = 7,
                    Description         = "Couscous",
                    ChefEmail           = "*****@*****.**"
                }
                    );
                context.SaveChanges();
            }
        }
Exemple #2
0
 public EFChefRepository(AppChefDbContext ctx)
 {
     context = ctx;
 }