Ejemplo n.º 1
0
        public void AddItem(Guitar guitar, int quantity)
        {
            CartLine line = lineCollection
                            .Where(p => p.Guitar.Id == guitar.Id)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    Guitar   = guitar,
                    Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Ejemplo n.º 2
0
 public void RemoveLine(Guitar guitar)
 {
     lineCollection.RemoveAll(l => l.Guitar.Id == guitar.Id);
 }