private void AddPizza() { Pizza pizza = new Pizza(Name, Desc, Price, BaseIngredient, ListIngredientsInPizza); //PizzaService.Instance.AddPizza(pizza); _pizzaService.AddPizza(pizza); NavigationService.GoBackAsync(); }
public IActionResult Create(CreatePizzaViewModel model) { if (ModelState.IsValid) { int count = _pizzaService.AddPizza(model); return(RedirectToAction("index")); } return(View()); }
//[ServiceFilter(typeof(ValidationFilter))] public IActionResult Create(CreatePizzaViewModel model) { //not needed anymore, validation done with ValidationFilter registered globally //if (ModelState.IsValid) //{ int count = _pizzaService.AddPizza(model); return(RedirectToAction("index")); //} //return View(); }
public IActionResult CreatePizza(Pizza pizza) { if (pizza == null) { return(BadRequest()); } var orderId = pizzaService.AddPizza(pizza); return(Ok(orderId)); }
public void Post([FromBody] Pizza pizza) { _pizzaService.AddPizza(pizza); }