public virtual void AddItem(ProductDocDb product, int quantity) { CartLine line = lineCollection.Where(p => p.productId == product.Id).FirstOrDefault(); if (line == null) { lineCollection.Add(new CartLine { productId = product.Id, quantity = quantity }); } else { line.quantity += quantity; } }
public virtual void RemoveLine(ProductDocDb product) => lineCollection.RemoveAll(l => l.productId == product.Id);
public override void RemoveLine(ProductDocDb product) { base.RemoveLine(product); Session.SetJson("Cart", this); }
public override void AddItem(ProductDocDb product, int quantity) { // base means base class base.AddItem(product, quantity); Session.SetJson("Cart", this); }