コード例 #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Please enter the payment type: \n 1 for Physical Product \n 2 for Books \n 3 for Membership");

            int choice = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Your made payment for : " + choice);

            ActionFactory af             = new ActionFactory();
            ITakeAction   selectedAction = af.GetAfterPaymentAction(choice);

            selectedAction.TakeActionAfterPayment();
        }
コード例 #2
0
        public override ITakeAction GetAfterPaymentAction(int paymentType)
        {
            if (paymentType == 1)
            {
                _action = new AfterPayment.PhysicalProduct();
            }
            else if (paymentType == 2)
            {
                _action = new AfterPayment.Books();
            }
            else if (paymentType == 3)
            {
                _action = new AfterPayment.Membership();
            }

            return(_action);
        }