public ActionResult AddToOrder(ProductGridItem product) { if (Session["LoggedUserId"] != null) { return(RedirectToAction("AddProduct", "Order", product)); } else { return(RedirectToAction("Register", "Account")); } }
// GET: Order public ActionResult AddProduct(ProductGridItem product) { foreach (var it in items) { if (it.Name == product.Name) { it.Quantity++; totalKcal += it.Kcal; totalPrice += it.Price; return(RedirectToAction("Index", "Products")); } } items.Add(new OrderGridItem { Name = product.Name, Kcal = product.Kcal, Id = product.Id, Price = product.Price, Quantity = 1 }); return(RedirectToAction("Index", "Products", new { sortOrder = "Name" })); }