Esempio n. 1
0
        private void FuelVehicle()
        {
            string licenseNumber    = UI.GetLicenseNumberInput();
            string fuelType         = UI.GetFuelTypeInput();
            float  fuelAmmountToAdd = UI.GetFuelAmmountInput();
            bool   isVehicleListed  = m_Garage.IsVehicleListed(licenseNumber);

            if (isVehicleListed)
            {
                try
                {
                    m_Garage.FuelUpVehicle(licenseNumber, fuelAmmountToAdd, fuelType);
                }
                catch (ValueOutOfRangeException valueOutOfRangeException)
                {
                    Console.WriteLine(valueOutOfRangeException.Message);
                    FuelVehicle();
                }
                catch (ArgumentException argumentException)
                {
                    Console.WriteLine(argumentException.Message);
                    FuelVehicle();
                }
            }
            else
            {
                UI.NoRecordFound();
            }
        }