Ejemplo n.º 1
0
        public Product AddProduct(string name, int price, int count)
        {
            //
            var product = new Product(count)
            {
                Id=Guid.NewGuid(),
                Name=name,
                Price =price,

            };
            products.Add(product);
            return product;
        }
 public void AddProduct(Product product)
 {
     if (!products.ContainsKey(product.Id))
     {
         products[product.Id] = product;
     }
     else
     {
         products[product.Id].Increment(product.Count);
     }
 }