Esempio n. 1
0
        static void Main(string[] args)
        {
            CustomerChoice  pizza        = new CustomerChoice("Capriciosa");
            CustomerChoice  pasta        = new CustomerChoice("Spaghetti");
            CustomerChoice  drink        = new CustomerChoice("Cola");
            MethodOfPayment byCash       = new MethodOfPayment();
            MethodOfPayment byCreditCard = new MethodOfPayment();

            OrderCommand       orderPizza = new OrderCommand(pizza, 20);
            GetDiscountCommand orderdrink = new GetDiscountCommand(drink, 6);
            PaymentCommand     payByCash  = new PaymentCommand(byCash, "Cash");

            DeliveryFood firstOrder = new DeliveryFood();

            firstOrder.Add(orderPizza);
            firstOrder.Add(orderdrink);
            firstOrder.Add(payByCash);
            firstOrder.Run();

            DeliveryFoodAdapter OrderAdapter = new DeliveryFoodAdapter();

            OrderAdapter.Run(new List <ICommand>()
            {
                orderPizza, orderdrink, payByCash
            });
        }
Esempio n. 2
0
 public GetDiscountCommand(CustomerChoice customerChoice, int price)
 {
     _customerChoice = customerChoice;
     _price          = price;
 }
Esempio n. 3
0
 public OrderCommand(CustomerChoice customerChoice, int price)
 {
     _customerChoice = customerChoice;
     _price          = price;
 }