public void AddOrder(Order order) { //take care of order basics _db.Add(Mapper.Map(order)); //take care of individual pizzas foreach (var p in order.Pizzas) { Data.Pizzas datP = Mapper.Map(p); _db.Add(datP); Save(); OrderPizzaJunction opj = new OrderPizzaJunction { OrderId = order.Id, Quantity = 1, PizzaId = datP.Id }; AddOrderPizzaJunction(opj); //add crust to ingredients Data.Ingredients datI = Mapper.Map(new Ingredient { Name = p.CrustType, Type = "crust" }); AddPizzaIngredientJunction(new PizzaIngredientJunction { PizzaId = datP.Id, IngredientId = datI.Name }); //add sauce to ingredients datI = Mapper.Map(new Ingredient { Name = p.SauceType, Type = "sauce" }); AddPizzaIngredientJunction(new PizzaIngredientJunction { PizzaId = datP.Id, IngredientId = datI.Name }); //add remaining toppings to ingredients foreach (var t in p.Toppings) { datI = Mapper.Map(new Ingredient { Name = t, Type = "topping" }); AddPizzaIngredientJunction(new PizzaIngredientJunction { PizzaId = datP.Id, IngredientId = datI.Name }); } Save(); } }
public void AddNewSize(string name, decimal basePrice, decimal toppingPrice, int iUS) { if (ContainsSize(name) || basePrice <= 0m || toppingPrice <= 0m || iUS <= 0) { return; } var sp = new Data.SizingPricing { Size = name, BasePrice = basePrice, ToppingPrice = toppingPrice, IngredientUsageScalar = iUS }; _db.Add(sp); }
public void AddOrders(data.Orders x) { _db.Add(x); }
public void AddIngredient(Ingredient i) { _db.Add(Mapper.Map(i)); }
public void AddPizza(Pizza p) { _db.Add(Mapper.Map(p)); }
public void AddUser(User u) { _db.Add(Mapper.Map(u)); }
// Adds user to the db public void AddUser(User user) { _db.Add(Mapper.Map(user, GetLocationId(user.LocationName))); }