public IActionResult CreateCustomPizza(Pizzas pz, [FromServices] IPizzas repositoryPizzas, [FromServices] IStoreInfo repositoryStoreInfo) { if (pz.Topping1 == "") { pz.Topping1 = null; } if (pz.Topping2 == "") { pz.Topping2 = null; } if (pz.Topping3 == "") { pz.Topping3 = null; } repositoryPizzas.Add(pz); StoreInfo store = null; repositoryStoreInfo.SetStore(Convert.ToInt32(TempData["storeId"]), ref store); decimal pizzaPrice = calculatePrice(pz, store.StorePrice); pz.Price = pizzaPrice; PizzaList.manyPizzas.Add(pz); return(RedirectToAction(nameof(KeepOrdering))); }
public IActionResult SubmitOrder([FromServices] IPizzas repositoryPizzas, [FromServices] IOrdersPizzaInfo repositoryOrdersPizzaInfo) { foreach (Pizzas p in PizzaList.manyPizzas) { repositoryPizzas.Add(p); OrdersPizzaInfo ordersPizza = new OrdersPizzaInfo() { OrderId = Convert.ToInt32(TempData["orderId"]), PizzaId = p.PizzaId }; repositoryOrdersPizzaInfo.Add(ordersPizza); } return(View("OrderDetails")); }