示例#1
0
        private void printVehicleDetails()
        {
            Console.Clear();
            bool isValidInput = false;

            do
            {
                try
                {
                    getLicensePlate(out string licensePlate);
                    Validation.IsNumbersString(licensePlate);
                    if (m_garage.VehicleExist(licensePlate) == true)
                    {
                        VehicleDetails vehicleToPrint = m_garage.GetVehicleDetails(licensePlate);
                        Console.WriteLine(vehicleToPrint.ToString());
                        Console.WriteLine("Press enter to continue");
                        Console.ReadLine();
                    }
                    else
                    {
                        Console.WriteLine("There is no vehicle with that license plate");
                    }

                    isValidInput = true;
                }
                catch (FormatException fe)
                {
                    Console.WriteLine(fe.Message);
                }
            }while(isValidInput == false);
        }