示例#1
0
        public virtual void AddItem(Bookstore book, int qty)
        {
            CartLine line = Lines
                            .Where(b => b.Bookstore.BookID == book.BookID)
                            .FirstOrDefault();

            if (line == null)
            {
                Lines.Add(new CartLine
                {
                    Bookstore = book,
                    Quantity  = qty
                });
            }
            else
            {
                line.Quantity += qty;
            }
        }
示例#2
0
 public virtual void RemoveLine(Bookstore book) =>
 Lines.RemoveAll(x => x.Bookstore.BookID == book.BookID);
示例#3
0
 public override void RemoveLine(Bookstore bookstore)
 {
     base.RemoveLine(bookstore);
     Session.SetJson("Cart", this);
 }
示例#4
0
 public override void AddItem(Bookstore bookstore, int quantity)
 {
     base.AddItem(bookstore, quantity);
     Session.SetJson("Cart", this);
 }