コード例 #1
0
        private static void showCarsByStatus(Ex03.GarageLogic.Garage i_Garage)
        {
            string optionsMsg = string.Format(
                @"Please select which cars information would you like to see.
0. All
{0}",
                i_Garage.GetStatusOptions());

            Console.WriteLine(optionsMsg);
            int selection = InputValidation.GetIntValueInRange(0, i_Garage.GetNumberOfStatusOptions());

            Console.WriteLine(i_Garage.VehcilesByStatusToString(selection));
        }
コード例 #2
0
        private static void changeVehicleStatus(Ex03.GarageLogic.Garage i_Garage)
        {
            Console.WriteLine("Please enter the vehicles license number");
            string licenseNumber = InputValidation.GetCarLicense();
            bool   isCarExists   = i_Garage.CarIsAlreadyInGarage(licenseNumber);

            if (isCarExists)
            {
                string msg = string.Format(
                    @"Please select the new vehicle status
{0}",
                    i_Garage.GetStatusOptions());
                Console.WriteLine(msg);
                int selection = InputValidation.GetIntValueInRange(1, i_Garage.GetNumberOfStatusOptions());
                i_Garage.ChangeCarStatus(licenseNumber, selection);
            }
            else
            {
                Console.WriteLine("Could not locate car in the garage. Please try again later.");
            }
        }