예제 #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());
 }
예제 #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();
        }
예제 #4
0
        public IActionResult CreatePizza(Pizza pizza)
        {
            if (pizza == null)
            {
                return(BadRequest());
            }

            var orderId = pizzaService.AddPizza(pizza);

            return(Ok(orderId));
        }
예제 #5
0
 public void Post([FromBody] Pizza pizza)
 {
     _pizzaService.AddPizza(pizza);
 }