static void Main(string[] args) { var modifyPrice = new ModifyPrice(); var product = new Product("PS4", 500); Console.WriteLine($"{product}"); Execute(product, modifyPrice, new ProductCommand(product, PriceAction.Increase, 100)); Execute(product, modifyPrice, new ProductCommand(product, PriceAction.Increase, 50)); Execute(product, modifyPrice, new ProductCommand(product, PriceAction.Decrease, 25)); Console.WriteLine($"{product}"); Console.ReadKey(); }
private static void Execute(Product product, ModifyPrice modifyPrice, ICommand productCommand) { modifyPrice.SetCommand(productCommand); modifyPrice.Invoke(); }