Exemplo n.º 1
0
        public virtual void AddItem(MusicProduct product, int quantity)
        {
            CartLine line = lineCollection.Where(p => p.Product.MusicID == product.MusicID).FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    Product  = product,
                    Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Exemplo n.º 2
0
 public virtual void RemoveLine(MusicProduct product) => lineCollection.RemoveAll(l => l.Product.MusicID == product.MusicID);