Exemple #1
0
        public ActionResult UpdateItem(int id, int qty)
        {
            return(SheepJaxed.On <ICartCommands>(cmd =>
            {
                var item = CartItem.All().First(x => x.Id == id);
                item.Qty = qty;

                if (item.Qty == 0)
                {
                    cmd.RemoveItem();
                }
                else if (item.Qty < 0)
                {
                    cmd.MarkInvalid();
                }
                else
                {
                    cmd.ChangeTotalPrice(item.TotalPrice);
                }
            }));
        }
Exemple #2
0
 public ActionResult Index()
 {
     return(View(CartItem.All()));
 }