Пример #1
0
        static void Main(string[] args)
        {
            OrderPrompt orderPrompt = new OrderPrompt();

            while (orderPrompt.Prompt())
            {
            }

            CustomersCollection c = new CustomersCollection();

            c.GetCustomerByName("John", "Wall");

            Console.WriteLine(); Console.ReadLine();
        }
Пример #2
0
        // Prompts the user for their full name
        private void NamePrompt()
        {
            while (true)
            {                                               // Prompt user for input
                Console.Write("Welcome to XYZ store Please enter your full name: ");
                //store user input
                fullName = Console.ReadLine();

                // Validate input (name can't be empty or number value)
                if (!string.IsNullOrEmpty(fullName) && !int.TryParse(fullName, out _))// out _ is a Discard dummy var
                {
                    string[]            n = fullName.Split(' ');
                    CustomersCollection c = new CustomersCollection();
                    c.AddCustomer(n[0], n[1]);                          //save Customer to the DB


                    break; //break loop ... next line code after this method
                }
                else
                {
                    Console.WriteLine("\nThe name cannot be a number or an empty space");
                }
            }       //statement is still true ... starts the loop over
        }