Beispiel #1
0
        public void AddItem(Tovar tovar, int quantity)
        {
            CartLine line = lineCollection.Where(g => g.Tovar.idTovara == tovar.idTovara).FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine {
                    Tovar = tovar, Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Beispiel #2
0
 public void RemoveLine(Tovar tovar)
 {
     lineCollection.RemoveAll(l => l.Tovar.idTovara == tovar.idTovara);
 }