コード例 #1
0
        public static Customer HaveYouBeenHereBefore()
        {
            var currentCustomer = new UserSystem();

            Console.Write("Welcome! Have you been here before? (y/n):");
            string mainUserInput = Console.ReadLine();

            try
            {
                switch (mainUserInput)
                {
                case "y":
                    return(currentCustomer.OldCustomer());

                case "n":
                    return(currentCustomer.AddCustomer());

                default:
                    Console.WriteLine("Not a valid option. Try again");
                    return(HaveYouBeenHereBefore());
                }
            }
            catch (FormatException)
            {
                Console.WriteLine("You have to enter (y/n) Try again");
                return(HaveYouBeenHereBefore());
            }
        }