/*public Library.PurOrder PlaceOrder(string Phonenumber,int store,Dictionary<string, int> product) * { * if(VerifyCustomer(Phonenumber)== true) * { * Library.PurOrder order = new Library.PurOrder * { * * * CustomerId =int.Parse( GetCustomer(Phonenumber)), * StoreId = store, * * * * } * * * } * }*/ public int AddToCart(Library.Product item) { // Get the matching cart and item instances var cartItem = _dbContext.Cart.SingleOrDefault( c => c.ProductId == item.ProductId); if (cartItem == null) { // Create a new cart item if no cart item exists cartItem = new Entities.Cart { ProductId = item.ProductId, Qty = 1 }; _dbContext.Cart.Add(cartItem); } else { // If the item does exist in the cart, // then add one to the quantity cartItem.Qty++; } // Save changes _dbContext.SaveChanges(); return(cartItem.Qty); }
public static void Initialize(PizzaStoreContext db) { var toppings = new Topping[] { new Topping() { Name = "Extra cheese", Price = 2.50m, }, new Topping() { Name = "American bacon", Price = 2.99m, }, new Topping() { Name = "British bacon", Price = 2.99m, }, new Topping() { Name = "Canadian bacon", Price = 2.99m, }, new Topping() { Name = "Tea and crumpets", Price = 5.00m }, new Topping() { Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { Name = "Bell peppers", Price = 1.00m, }, new Topping() { Name = "Onions", Price = 1.00m, }, new Topping() { Name = "Mushrooms", Price = 1.00m, }, new Topping() { Name = "Pepperoni", Price = 1.00m, }, new Topping() { Name = "Duck sausage", Price = 3.20m, }, new Topping() { Name = "Venison meatballs", Price = 2.50m, }, new Topping() { Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { Name = "Lobster on top", Price = 64.50m, }, new Topping() { Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { Name = "Fresh tomatos", Price = 1.50m, }, new Topping() { Name = "Basil", Price = 1.50m, }, new Topping() { Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { Name = "Blue cheese", Price = 2.50m, }, }; var specials = new PizzaSpecial[] { new PizzaSpecial() { Name = "Basic Cheese Pizza", Description = "It's cheesy and delicious. Why wouldn't you want one?", BasePrice = 9.99m, ImageUrl = "img/pizzas/cheese.jpg", }, new PizzaSpecial() { Id = 2, Name = "The Baconatorizor", Description = "It has EVERY kind of bacon", BasePrice = 11.99m, ImageUrl = "img/pizzas/bacon.jpg", }, new PizzaSpecial() { Id = 3, Name = "Classic pepperoni", Description = "It's the pizza you grew up with, but Blazing hot!", BasePrice = 10.50m, ImageUrl = "img/pizzas/pepperoni.jpg", }, new PizzaSpecial() { Id = 4, Name = "Buffalo chicken", Description = "Spicy chicken, hot sauce and bleu cheese, guaranteed to warm you up", BasePrice = 12.75m, ImageUrl = "img/pizzas/meaty.jpg", }, new PizzaSpecial() { Id = 5, Name = "Mushroom Lovers", Description = "It has mushrooms. Isn't that obvious?", BasePrice = 11.00m, ImageUrl = "img/pizzas/mushroom.jpg", }, new PizzaSpecial() { Id = 6, Name = "The Brit", Description = "When in London...", BasePrice = 10.25m, ImageUrl = "img/pizzas/brit.jpg", }, new PizzaSpecial() { Id = 7, Name = "Veggie Delight", Description = "It's like salad, but on a pizza", BasePrice = 11.50m, ImageUrl = "img/pizzas/salad.jpg", }, new PizzaSpecial() { Id = 8, Name = "Margherita", Description = "Traditional Italian pizza with tomatoes and basil", BasePrice = 9.99m, ImageUrl = "img/pizzas/margherita.jpg", }, }; db.Toppings.AddRange(toppings); db.Specials.AddRange(specials); db.SaveChanges(); }
public static void Initialize(PizzaStoreContext db) { db.Toppings.AddRange(PizzaToppings); db.Specials.AddRange(PizzaSpecials); db.SaveChanges(); }
public static void Initialize(PizzaStoreContext db) { var toppings = new Topping[] { new Topping() { Name = "Extra cheese", Price = 2.50m, }, new Topping() { Name = "American bacon", Price = 2.99m, }, new Topping() { Name = "British bacon", Price = 2.99m, }, new Topping() { Name = "Canadian bacon", Price = 2.99m, }, new Topping() { Name = "Tea and crumpets", Price = 5.00m }, new Topping() { Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { Name = "Bell peppers", Price = 1.00m, }, new Topping() { Name = "Onions", Price = 1.00m, }, new Topping() { Name = "Mushrooms", Price = 1.00m, }, new Topping() { Name = "Pepperoni", Price = 1.00m, }, new Topping() { Name = "Duck sausage", Price = 3.20m, }, new Topping() { Name = "Venison meatballs", Price = 2.50m, }, new Topping() { Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { Name = "Lobster on top", Price = 64.50m, }, new Topping() { Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { Name = "Fresh tomatos", Price = 1.50m, }, new Topping() { Name = "Basil", Price = 1.50m, }, new Topping() { Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { Name = "Blue cheese", Price = 2.50m, }, }; var specials = new PizzaSpecial[] { new PizzaSpecial() { Name = "Basic Cheese Pizza", Description = "It's cheesy and delicious. Why wouldn't you want one?", BasePrice = 9.99m, ImageUrl = "img/pizzas/cheese.jpg", }, new PizzaSpecial() { Id = 2, Name = "The Baconatorizor", Description = "It has EVERY kind of bacon", BasePrice = 11.99m, ImageUrl = "img/pizzas/bacon.jpg", }, new PizzaSpecial() { Id = 3, Name = "Classic pepperoni", Description = "It's the pizza you grew up with, but Blazing hot!", BasePrice = 10.50m, ImageUrl = "img/pizzas/pepperoni.jpg", }, new PizzaSpecial() { Id = 4, Name = "Buffalo chicken", Description = "Spicy chicken, hot sauce and bleu cheese, guaranteed to warm you up", BasePrice = 12.75m, ImageUrl = "img/pizzas/meaty.jpg", }, new PizzaSpecial() { Id = 5, Name = "Mushroom Lovers", Description = "It has mushrooms. Isn't that obvious?", BasePrice = 11.00m, ImageUrl = "img/pizzas/mushroom.jpg", }, new PizzaSpecial() { Id = 6, Name = "The Brit", Description = "When in London...", BasePrice = 10.25m, ImageUrl = "img/pizzas/brit.jpg", }, new PizzaSpecial() { Id = 7, Name = "Veggie Delight", Description = "It's like salad, but on a pizza", BasePrice = 11.50m, ImageUrl = "img/pizzas/salad.jpg", }, new PizzaSpecial() { Id = 8, Name = "Margherita", Description = "Traditional Italian pizza with tomatoes and basil", BasePrice = 9.99m, ImageUrl = "img/pizzas/margherita.jpg", }, new PizzaSpecial() { Id = 9, Name = "test", Description = "test", BasePrice = 9.99m, ImageUrl = "img/pizzas/margherita.jpg", }, }; var dbDoughs = new DbDough[] { new DbDough { Name = "Thin Crust", Description = "Thinnest Dough in restaurant", Cost = 7, ImgSrc = "img/dough/Thin-Crust-Pizza-Dough.jpg" }, new DbDough { Name = "Flat Bread Crust", Description = "It is pretty flat", Cost = 6, ImgSrc = "img/dough/flatbreadcrust-dough.jpg" } }; var dbCheese = new DbCheese[] { new DbCheese { Name = "Mozzarella Cheese", Description = "It is from italy", Cost = 3 }, new DbCheese { Name = "Cheddar Chesse", Description = "Just Cheddar Chesse", Cost = 4 } }; var dbSausage = new DbSausage[] { new DbSausage { Name = "Kielbasa Sausage", Description = "Kielbasa", Cost = 8 }, new DbSausage { Name = "Italian Sausage", Description = "It is really import from Italy", Cost = 10 } }; db.Toppings.AddRange(toppings); db.Specials.AddRange(specials); db.SaveChanges(); db.Doughs.AddRange(dbDoughs); db.Cheeses.AddRange(dbCheese); db.Sausages.AddRange(dbSausage); db.SaveChanges(); }
public void SaveChanges() { _db.SaveChanges(); }
public static void Initialize(PizzaStoreContext db) { var toppings = new Topping[] { new Topping() { Name = "Допълнително сирене", Price = 1.50m, }, new Topping() { Name = "Американски бекон", Price = 1.99m, }, new Topping() { Name = "Британски бекон", Price = 1.99m, }, new Topping() { Name = "Канадски бекон", Price = 1.99m, }, new Topping() { Name = "чай с бисквити", Price = 3.00m }, new Topping() { Name = "Прясно изпечени котлети", Price = 3.50m, }, new Topping() { Name = "Камби", Price = 1.00m, }, new Topping() { Name = "Лук", Price = 1.00m, }, new Topping() { Name = "Гъби", Price = 1.00m, }, new Topping() { Name = "Пеперони", Price = 1.00m, }, new Topping() { Name = "Патешко месо", Price = 2.20m, }, new Topping() { Name = "Кюфтенца", Price = 1.50m, }, new Topping() { Name = "Омар", Price = 44.50m, }, new Topping() { Name = "Хайвер", Price = 80.75m, }, new Topping() { Name = "Артишок", Price = 2.40m, }, new Topping() { Name = "Пресни домати", Price = 0.50m, }, new Topping() { Name = "Босилек", Price = 0.50m, }, new Topping() { Name = "Пържола (medium-rare)", Price = 8.50m, }, new Topping() { Name = "Люти чушки", Price = 2.20m, }, new Topping() { Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { Name = "Синьо сирене", Price = 1.50m, }, }; var specials = new PizzaSpecial[] { new PizzaSpecial() { Name = "Basic Cheese Pizza", Description = "Много вкусна. Защо не си вземеш една?", BasePrice = 9.99m, ImageUrl = "img/pizzas/cheese.jpg", }, new PizzaSpecial() { Id = 2, Name = "The Baconatorizor", Description = "Има ВСЕКИ вид бекон", BasePrice = 11.99m, ImageUrl = "img/pizzas/bacon.jpg", }, new PizzaSpecial() { Id = 3, Name = "Classic pepperoni", Description = "Пицата от твоето детство, но с повече люто!", BasePrice = 10.50m, ImageUrl = "img/pizzas/pepperoni.jpg", }, new PizzaSpecial() { Id = 4, Name = "Buffalo chicken", Description = "Пикантно пилешко едно от най-добрите", BasePrice = 12.75m, ImageUrl = "img/pizzas/meaty.jpg", }, new PizzaSpecial() { Id = 5, Name = "Mushroom Lovers", Description = "Има гъби.Очевидно", BasePrice = 11.00m, ImageUrl = "img/pizzas/mushroom.jpg", }, new PizzaSpecial() { Id = 6, Name = "Veggie Delight", Description = "Като салата, но върху пица", BasePrice = 11.50m, ImageUrl = "img/pizzas/salad.jpg", }, new PizzaSpecial() { Id = 7, Name = "Margarita", Description = "Традиционна италианска пица с домати и босилек", BasePrice = 9.99m, ImageUrl = "img/pizzas/margherita.jpg", }, }; db.Toppings.AddRange(toppings); db.Specials.AddRange(specials); db.SaveChanges(); }