Example #1
0
 public ActionResult AddToOrder(ProductGridItem product)
 {
     if (Session["LoggedUserId"] != null)
     {
         return(RedirectToAction("AddProduct", "Order", product));
     }
     else
     {
         return(RedirectToAction("Register", "Account"));
     }
 }
Example #2
0
        // 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" }));
        }