Пример #1
0
        public void AddItem(Ware ware, int quantity)
        {
            CartLine line = lineCollection
                            .Where(g => g.Ware.ID == ware.ID)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    Ware     = ware,
                    Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Пример #2
0
 public void RemoveLine(Ware ware)
 {
     lineCollection.RemoveAll(l => l.Ware.ID == ware.ID);
 }