Пример #1
0
        private void                    addVehicalToTheGarage()
        {
            bool doesVehicalExist = false;

            Console.Clear();
            string licensePlate = askLicensePlate();

            doesVehicalExist = r_Garage.DoesVehicalExist(licensePlate);
            if (doesVehicalExist)
            {
                r_Garage.ChangeVehicalStatus(licensePlate, GarageLogic.Enums.eVehicalStatus.InRepair);
                Console.WriteLine("The vehical license plate is already in the system, status changed to in repair.");
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Please choose the type of vehical you want to add");
                VehicalFactory.eVehicalTypes vehicalType = (VehicalFactory.eVehicalTypes)enumParse <VehicalFactory.eVehicalTypes>();
                VehicalInformation           newVehical  = new VehicalInformation();
                Console.Clear();
                string vehicalModel = askString("vehicals model");
                newVehical.Vehical = VehicalFactory.CreateVehical(vehicalType, vehicalModel, licensePlate);
                askVehicalDetails(newVehical);
                r_Garage.AddVehical(newVehical);
                Console.WriteLine("The vehical was successfully added to the garage!");
            }

            returnToMenuPrompt();
        }