Exemplo n.º 1
0
        //Should probably not use garagehandler in UI be and also
        //maybe fetch minLength,maxlength from Vehicle class
        public static string AskForRegistrationNumber(GarageHandler garageHandler)
        {
            bool   regNrExists;
            string regNo = "";

            do
            {
                regNrExists = false;
                regNo       = AskForString("Enter a registrationnumber", minLength: 5, maxLength: 8);
                if (garageHandler.Contains(regNo))
                {
                    regNrExists = true;
                    Console.WriteLine($"RegistrationNumber {regNo} already exists in Garage");
                }
            } while (regNrExists);
            return(regNo);
        }