Beispiel #1
0
        public void RemoveOne(Solder solder, int quantity)
        {
            CartLine line = Lines.Where(s => s.Solder.Id == solder.Id).FirstOrDefault();

            if (line != null)
            {
                line.Quantity -= quantity;
            }

            if (line.Quantity == 0)
            {
                RemoveItem(line.Solder);
            }
        }
Beispiel #2
0
        public void AddItem(Solder solder, int quantity)
        {
            CartLine line = Lines.Where(s => s.Solder.Id == solder.Id).FirstOrDefault();

            if (line == null)
            {
                Lines.Add(new CartLine
                {
                    Solder   = solder,
                    Quantity = quantity
                });
            }

            else
            {
                line.Quantity += quantity;
            }
        }
Beispiel #3
0
 public void RemoveItem(Solder solder)
 {
     Lines.RemoveAll(s => s.Solder.Id == solder.Id);
 }