Example #1
0
 public void AddOderDetail(List <OrderDetail> orderDetails)
 {
     Db.OrderDetails.AddRange(orderDetails);
     Db.SaveChanges();
 }
Example #2
0
 public void AddProduct(Product product)
 {
     Db.Products.Add(product);
     Db.SaveChanges();
 }
 public void Insert(RestaurantType type)
 {
     _context.RestaurantTypes.Add(type);
     _context.SaveChanges();
 }
Example #4
0
 public bool Save()
 {
     return(_foodContext.SaveChanges() >= 0);
 }
Example #5
0
 public void Create(Dish t)
 {
     context.Dishes.Add(t);
     context.SaveChanges();
 }
Example #6
0
 public void Save()
 {
     context.SaveChanges();
 }
Example #7
0
        public static void Initialize(FoodContext context)
        {
            context.Database.EnsureCreated();

            // Look for any FoodCategories.
            if (context.FoodCategories.Any())
            {
                return;   // DB has been seeded
            }

            var foodCategories = new FoodCategory[]
            {
                new FoodCategory {
                    Name = "Vegetable"
                },
                new FoodCategory {
                    Name = "Fruit"
                },
                new FoodCategory {
                    Name = "Product"
                },
                new FoodCategory {
                    Name = "Sauce"
                },
                new FoodCategory {
                    Name = "Meat"
                },
                new FoodCategory {
                    Name = "Fish"
                },
                new FoodCategory {
                    Name = "Seafood"
                },
                new FoodCategory {
                    Name = "CannedGoods"
                },
                new FoodCategory {
                    Name = "Sweets"
                }
            };

            foreach (FoodCategory fc in foodCategories)
            {
                context.FoodCategories.Add(fc);
            }
            context.SaveChanges();

            var foodItems = new FoodItem[]
            {
                new FoodItem {
                    Name = "Cucumber", FoodCategoryId = 1
                },
                new FoodItem {
                    Name = "Apple", FoodCategoryId = 2
                },
                new FoodItem {
                    Name = "Twix", FoodCategoryId = 3
                },
                new FoodItem {
                    Name = "Ketchup", FoodCategoryId = 4
                },
                new FoodItem {
                    Name = "Poultry", FoodCategoryId = 5
                },
                new FoodItem {
                    Name = "Salmon", FoodCategoryId = 6
                },
                new FoodItem {
                    Name = "Shrimp", FoodCategoryId = 7
                },
                new FoodItem {
                    Name = "Canned Peaches", FoodCategoryId = 8
                },
                new FoodItem {
                    Name = "Nomeda", FoodCategoryId = 9
                }
            };

            foreach (FoodItem fi in foodItems)
            {
                context.FoodItems.Add(fi);
            }
            context.SaveChanges();

            var userLogins = new UserLogin[]
            {
                new UserLogin {
                    Username = "******", Password = "******", Token = "tokentokentokentoken"
                },
                new UserLogin {
                    Username = "******", Password = "******", Token = "tokentokentokentoken2"
                }
            };

            foreach (UserLogin ul in userLogins)
            {
                context.UserLogins.Add(ul);
            }
            context.SaveChanges();

            var users = new User[]
            {
                new User {
                    Name = "Pranas", UserLoginId = 1
                },
                new User {
                    Name = "Jonas", UserLoginId = 2
                }
            };

            foreach (User u in users)
            {
                context.Users.Add(u);
            }
            context.SaveChanges();

            var carts = new Cart[]
            {
                new Cart {
                    Name = "Cart1", UserId = 1
                },
                new Cart {
                    Name = "Cart2", UserId = 2
                }
            };

            foreach (Cart c in carts)
            {
                context.Carts.Add(c);
            }
            context.SaveChanges();

            var cartItems = new CartItem[]
            {
                new CartItem {
                    FoodItemId = 2, CartId = 1, Count = 1
                },
                new CartItem {
                    FoodItemId = 3, CartId = 2, Count = 1
                }
            };

            foreach (Cart c in carts)
            {
                context.Carts.Add(c);
            }
            context.SaveChanges();
        }
Example #8
0
 public void Save()
 {
     _dbContext.SaveChanges();
 }
Example #9
0
 public void AddFood(Food food)
 {
     FoodContext.Foods.Add(food);
     FoodContext.SaveChanges();
 }
Example #10
0
        public static void Initialize(FoodContext context)
        {
            //context.Database.EnsureCreated();
            if (context.Recipes.Any())
            {
                return;
            }

            var recipeArroz = new Recipe()
            {
                AuthorName  = "Jesus DIcent",
                Name        = "Arroz blanco a la mantequilla",
                Description = "Esta receta queda deliciosa y es perfecta para acompañar tus platillos favoritos, sobre todo nuestros deliciosos platos fuertes mexicanos como el picadillo, la tinga de pollo, un delicioso pollo al pastor, fajitas, enmoladas, pescado en salsa de mango y muchas más.",
            };

            context.Recipes.Add(recipeArroz);
            context.SaveChanges();
            var id  = recipeArroz.RecipeId;
            var ing = new Ingredient[]
            {
                new Ingredient {
                    RecipeId = id, Descripcion = " 1 taza de arroz blanco crudo"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "1 trocito pequeño de cebolla blanca"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "1 diente de ajo chico pelado"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "Media taza de agua para licuar cebolla & ajo"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "2 tazas caldo de pollo de vegetales o agua (caliente)"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "2 cucharadas mantequilla"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "Una Cuarta parte de una taza zanahoria en cubos 1 zanahoria chica"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "Una cuarta parte de una taza chícharo congelado"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "una cuarta de taza elote cocido"
                },
                new Ingredient {
                    RecipeId = id, Descripcion = "Sal y pimienta al gusto"
                }
            };

            context.Ingredients.AddRange(ing);
            context.SaveChanges();

            var steps = new Step[]
            {
                new Step {
                    StepNumber = 1, RecipeId = id, Content = "Lava muy bien el arroz y seca en el colador."
                },
                new Step {
                    StepNumber = 2, RecipeId = id, Content = "Fríe el arroz a fuego medio alto en la mantequilla, esto asegura un arroz que no se bata después. Mueve constantemente cuanto estés haciendo esto. Antes de que se empiece a dorar agrega la mezcla de cebolla y ajo y sofríe un minuto más o hasta que casi se evapore el líquido."
                },
                new Step {
                    StepNumber = 3, RecipeId = id, Content = "Pasado el tiempo agrega el caldo caliente, sal y vegetales. Al primer hervor baja el fuego, tapa y cocina 15 minutos o hasta que se consuma el líquido por completo."
                },
                new Step {
                    StepNumber = 4, RecipeId = id, Content = "A los 15 minutos revisar que no tenga líquido, si ya está seco, apaga el fuego, tapa y deja reposar 10 a 15 minutos para que pueda seguirse cociendo con su calor."
                },
                new Step {
                    StepNumber = 5, RecipeId = id, Content = "Separa los granos con un tenedor."
                }
            };

            context.Steps.AddRange(steps);
            context.SaveChanges();
        }
Example #11
0
 public void Add(Food food)
 {
     context.Foods.Add(food);
     context.SaveChanges();
 }
 public ActionResult Create(Cusisine cusisine)
 {
     _db.Cusisines.Add(cusisine);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Create(Review review)
 {
     _db.Reviews.Add(review);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Example #14
0
 public void Add(Meal meal)
 {
     foodContext.Meals.Add(meal);
     foodContext.SaveChanges();
 }
Example #15
0
 public void Add(Ingredient ingredient)
 {
     foodContext.Ingredients.Add(ingredient);
     foodContext.SaveChanges();
 }