public string AddProduct(string type, double price) { ProductFactory productFactory = new ProductFactory(); Product product = productFactory.CreateProduct(type, price); this.productsPool.Add(product); return($"Added {type} to pool"); }
public string AddProduct(string type, double price) { Product product = productFactory.CreateProduct(type, price); this.products.Add(product); string result = $"Added {type} to pool"; return(result); }
public string AddProduct(string type, double price) { if (!this.productPool.ContainsKey(type)) { this.productPool[type] = new Stack <Product>(); } var product = productFactory.CreateProduct(type, price); this.productPool[type].Push(product); return($"Added {type} to pool"); }
public string AddProduct(string type, double price) { this.productPool.Add(productFactory.CreateProduct(type, price)); return($"Added {type} to pool"); }