public ActionResult Edit(int id) { PizzaDao pizzaDao = new PizzaDao(); IngredienceDao ingredienceDao = new IngredienceDao(); Pizza p = pizzaDao.GetById(id); ViewBag.Categories = ingredienceDao.GetAll(); return(View(p)); }
public ActionResult Delete(int id) { try { PizzaDao pizzaDao = new PizzaDao(); Pizza pizza = pizzaDao.GetById(id); pizzaDao.Delete(pizza); TempData["message-success"] = "Pizza " + pizza.Name + " byla smazana"; } catch (Exception exception) { throw; } return(RedirectToAction("Index")); }
public ActionResult AddToCart(int id) { PizzaDao pizzaDao = new PizzaDao(); Pizza p = pizzaDao.GetById(id); Order order = new Order { Id = p.Id, OrderDate = System.DateTime.Now, OrderedPizza = p.Name, Price = p.Price, CustomerAddress = "", CustomerName = "", PizzaCount = 1 }; TempData["myOrder"] = order; return(View(order)); }