Exemple #1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Welcome to our site. Would you like to order or repair?");
            string processOption  = Console.ReadLine().ToLower().Trim();
            var    phoneOrder     = new PhoneOrder();
            var    phoneRepair    = new PhoneRepair();
            var    accecoryRepair = new Accessory();

            string productDetail = string.Empty;

            switch (processOption)
            {
            case "order":
                Console.WriteLine("Please provide the phone model name");
                productDetail = Console.ReadLine().Trim();
                //phoneOrderRepair.ProcessOrder(productDetail);
                //Added
                phoneOrder.ProcessOrder(productDetail);
                break;

            case "repair":
                Console.WriteLine("Is it the phone or the accessory that you want to be repaired?");
                string productType = Console.ReadLine().ToLower();
                if (productType.Equals("phone"))
                {
                    Console.WriteLine("Please provide the phone model name");
                    productDetail = Console.ReadLine().Trim();
                    phoneRepair.ProcessPhoneRepair(productDetail);
                }
                else
                {
                    Console.WriteLine("Please provide the accessory detail, like headphone, tempered glass");
                    productDetail = Console.ReadLine().Trim();
                    accecoryRepair.ProcessAccessoryRepair(productDetail);
                }
                break;

            default:
                break;
            }

            Console.WriteLine("Thanks for choosing us. Have a great day.");
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to our site. Would you like to order or repair?");
            string Option = Console.ReadLine().ToLower().Trim();

            string productDetail;

            switch (Option)
            {
            case "order":
                Console.WriteLine("Please provide the phone model name");
                productDetail = Console.ReadLine().Trim();
                var phoneOrder = new PhoneOrder();
                phoneOrder.ProcessOrder(productDetail);
                break;

            case "repair":
                Console.WriteLine("Is it a phone or an accessory that you want to get repaired?");
                string productType = Console.ReadLine().ToLower();
                if (productType.Equals("phone"))
                {
                    Console.WriteLine("Please provide the phone model name");
                    productDetail = Console.ReadLine().Trim();
                    var phoneRepair = new PhoneRepair();
                    phoneRepair.ProcessPhoneRepair(productDetail);
                }
                else
                {
                    Console.WriteLine("Please provide the accessory detail, like headphone, tempered glass");
                    productDetail = Console.ReadLine().Trim();
                    var accessoryRepair = new AccessoryRepair();
                    accessoryRepair.ProcessAccessoryRepair(productDetail);
                }
                break;

            default:
                break;
            }

            Console.WriteLine("Thank you.");
            Console.ReadKey();
        }