Example #1
0
        public void AddItem(Book book, int quantity)
        {
            CartLine line = lineCollection.Where(b => b.Book.Id == book.Id).FirstOrDefault();

            if(line == null)
            {
                lineCollection.Add(new CartLine { Book = book, Quantity = quantity });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Example #2
0
 public void RemoveLine(Book book)
 {
     lineCollection.RemoveAll(l => l.Book.Id == book.Id);
 }