public void AddBook(V_Book b, int quantity) { CartLine line = lineCollection.Where(p => p.Book.BookID == b.BookID).FirstOrDefault(); if (line == null) { lineCollection.Add(new CartLine(b, quantity)); } else { line.Quantity += quantity; } }
public void UpdateQuantity(V_Book b, int quantity) { CartLine line = lineCollection.Where(p => p.Book.BookID == b.BookID).FirstOrDefault(); if (line == null) { } else { line.Quantity = quantity; } if (line.Quantity == 0) { lineCollection.Remove(line); } }
public CartLine(V_Book b, int quantity) { this.Book = b; this.Quantity = quantity; }