Пример #1
0
        private Contestant SearchForContestant()
        {
            string nameOrRegistrationNumber     = UserInterface.GetString("a name (first, last, or full) or registration number to search");
            bool   isPossibleRegistrationNumber = UserInterface.CheckWhetherNumberOrNot(nameOrRegistrationNumber);

            if (isPossibleRegistrationNumber == true)
            {
                int possibleRegistrationNumber;
                Int32.TryParse(nameOrRegistrationNumber, out possibleRegistrationNumber);
                Contestant possibleContestant = FindContestantByRegistrationNumber(possibleRegistrationNumber);
                if (possibleContestant == null)
                {
                    return(null);
                }
                return(possibleContestant);
            }
            else
            {
                List <Contestant> possibleContestants = FindContestantByName(nameOrRegistrationNumber);
                Contestant        contestant          = GetContestantFromList(possibleContestants);
                if (contestant == null)
                {
                    return(null);
                }
                return(contestant);
            }
        }