public override string TakeProduct(int quantity) { if (Quantity < quantity) { return($"No se puede retirar esta cantidad solo hay: {Quantity}."); } Quantity -= quantity; SaleProduct.Add(new Sale() { Product = this, QuantitySale = quantity, TotalCost = (CostProduct * quantity), TotalSale = (PriceProduct * quantity) }); return($"Se vendieron {quantity} de: {Name}"); }
public override string TakeProduct(int quantity) { if (quantity <= 0) { return("Para poder vender un producto la cantidad debe ser mayor a cero"); } for (var i = 0; i < quantity; i++) { Ingredients.ForEach(delegate(Minuta minuta) { minuta.Product.TakeProduct(minuta.Quantity); }); } SaleProduct.Add(new Sale() { Product = this, QuantitySale = quantity, TotalCost = (Cost() * quantity), TotalSale = (Price() * quantity) }); return($"Se vendieron {quantity} de: {Name}"); }