示例#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);
                }
            }));
        }
示例#2
0
 public ActionResult Index()
 {
     return(View(CartItem.All()));
 }