Пример #1
0
        public void Add(Item item)
        {
            ShoppingCartLine existingLine = FindLine(item);

            if (existingLine != null)
            {
                existingLine.Quantity += 1;
            }
            else
            {
                _cartLines.Add(new ShoppingCartLine(item));
            }
        }
Пример #2
0
        public void Add(ShoppingCartLine newLine)
        {
            ShoppingCartLine existingLine = FindLine(newLine);

            if (existingLine != null)
            {
                existingLine.Quantity += newLine.Quantity;
            }
            else
            {
                _cartLines.Add(newLine);
            }
        }
Пример #3
0
 public ShoppingCartLine FindLine(ShoppingCartLine otherLine)
 {
     return(FindLine(otherLine.Item));
 }
Пример #4
0
 public void RemoveLine(ShoppingCartLine otherLine)
 {
     RemoveLine(otherLine.Item);
 }