Ejemplo n.º 1
0
        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());
 }
Ejemplo n.º 3
0
        //[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();
        }
Ejemplo n.º 4
0
        public IActionResult CreatePizza(Pizza pizza)
        {
            if (pizza == null)
            {
                return(BadRequest());
            }

            var orderId = pizzaService.AddPizza(pizza);

            return(Ok(orderId));
        }
Ejemplo n.º 5
0
 public void Post([FromBody] Pizza pizza)
 {
     _pizzaService.AddPizza(pizza);
 }