Exemplo n.º 1
0
        public ActionResult Update(Pizza pizza, int ingredienceId)
        {
            try
            {
                PizzaDao       pizzaDao       = new PizzaDao();
                IngredienceDao ingredienceDao = new IngredienceDao();
                Ingredience    ingredience    = ingredienceDao.GetById(ingredienceId);
                pizza.Ingredience = ingredience;

                pizzaDao.Update(pizza);

                TempData["message-success"] = "Pizza " + pizza.Name + " byla upravena";
            }
            catch (Exception)
            {
                throw;
            }

            return(RedirectToAction("Index", "Admin"));
        }
Exemplo n.º 2
0
        public ActionResult Add(Pizza pizza, int ingredienceId)
        {
            if (ModelState.IsValid)
            {
                IngredienceDao ingredienceDao = new IngredienceDao();
                Ingredience    ingredience    = ingredienceDao.GetById(ingredienceId);
                pizza.Ingredience = ingredience;


                PizzaDao pizzaDao = new PizzaDao();
                pizzaDao.Create(pizza);

                TempData["message-success"] = "Pizza byla uspesne pridana";
            }
            else
            {
                TempData["message-error"] = "Pizza se nepridala";
                return(View("Create", pizza));
            }


            return(RedirectToAction("Index"));
        }