public void AddProductsToCart(int quantity, Product product)
 {
     if(_products.ContainsKey(product))
     {
         _products[product] += quantity;
     }
     else
     {
         _products.Add(product, quantity);    
     }
 }
Ejemplo n.º 2
0
 public bool Equals(Product other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.Id == Id && Equals(other.Name, Name);
 }