Ejemplo n.º 1
0
        public void AddItem(SportNutrition product, int quantity)
        {
            CartLine line = lineCollection
                            .Where(p => p.Product.SportNutritionId == product.SportNutritionId)
                            .FirstOrDefault();

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