Ejemplo n.º 1
0
        /// <summary>
        /// Calls DatabaseControl to get a list of Locations, Displays Locations
        /// Calls InputControl to get users choice of location or returing to Customer Homepage
        /// </summary>
        /// <returns>NextPage, CurrentLocation</returns>
        internal static (string, Location) DisplayStoreLocations()
        {
            Location CurrentLocation;
            string   NextPage = "STORE HOMEPAGE";

            List <Location> Locations = DatabaseControl.GetAllLocations();

            Console.WriteLine("----------------------STORES---------------------------");
            int NumStores = 1;

            foreach (Location l in Locations)
            {
                Console.WriteLine($"\n\nStore #{NumStores}" +
                                  $"\n--------------{l.Name}--------------" +
                                  $"\n{l.AddressNum} {l.AddressStreet} " +
                                  $"\n{l.AddressCity}, {l.AddressState} {l.AddressZipCode}");
                NumStores++;
            }
            Console.WriteLine("\nWhich store would you like to visit?" +
                              "\nEnter the store number to proceed" +
                              "\nEnter 0 to go back to the Customer Homepage");

            int choice = InputControl.VerifyListChoiceStartingAt0(NumStores);

            if (choice == -1)
            {
                NextPage        = "CUSTOMER HOMEPAGE";
                CurrentLocation = null;
            }
            else
            {
                CurrentLocation = Locations[choice];
            }
            return(NextPage, CurrentLocation);
        }