Beispiel #1
0
        static void Main(string[] args)
        {
            ModifyPrice modifyPrice = new ModifyPrice();
            Product     product     = new Product("Phone", 500);

            Execute(modifyPrice, new ProductCommand(product, PriceAction.Increase, 100));
            Execute(modifyPrice, new ProductCommand(product, PriceAction.Increase, 50));
            Execute(modifyPrice, new ProductCommand(product, PriceAction.Decrease, 25));
            Console.WriteLine(product);
        }
Beispiel #2
0
 private static void Execute(ModifyPrice modifyPrice, ProductCommand productCommand)
 {
     modifyPrice.SetCommand(productCommand);
     modifyPrice.Invoke();
 }