public IActionResult Create([Bind("Id,Name,Description,Price")] Pizza pizza) { if (ModelState.IsValid) { _context.CreatePizza(pizza); return(RedirectToAction(nameof(Index))); } return(View(pizza)); }
public IActionResult Create(Pizza pizza) { if (ModelState.IsValid) { _ps.CreatePizza(pizza); return(RedirectToAction(nameof(Index))); } return(View(pizza)); }
public void DeepCreate(Order order) { Create(order); order.GetPizzas().ToList().ForEach(pizza => { pizza.SetOrder(order); PizzaService.CreatePizza(pizza); }); order.GetBeverages().ToList().ForEach(beverage => { beverage.SetOrder(order); BeverageService.CreateBeverage(beverage); }); }
public void MakeOrder() { Console.WriteLine($"Choose any pizza: (1){PizzaType.California} (8$) , (2){PizzaType.Detroit}(10$), (3){PizzaType.Neapolitan}(12$)"); var pizzaType = Console.ReadLine(); var pizza = _pizzaService.ChoosePizza(pizzaType); _pizzaService.PayForPizza(_user); var createdPizza = _pizzaService.CreatePizza(pizza); Console.WriteLine($"{_user.Name}, please, take your {createdPizza.Name} pizza."); }
public ActionResult CreatePizza(Pizza newPizza) { if (ModelState.IsValid) { _pizzaService.CreatePizza(newPizza); return(RedirectToAction("Index", "Home")); } else { return(View(newPizza)); } //return View(); }
public RedirectToActionResult Create([Bind("Id,Name,Description,Price,Size")] Pizza pizza) { _context.CreatePizza(pizza); return(RedirectToAction(nameof(Index))); }
public Pizza Create(Pizza pizza) { return(PizzaService.CreatePizza(pizza)); }