Example #1
0
        public static bool Validate(Person person)
        {
            bool isValid = true;

            if (string.IsNullOrEmpty(person.FirstName))
            {
                StandardMessages.DisplayValidationError("First Name");
                isValid = false;
            }

            if (string.IsNullOrEmpty(person.LastName))
            {
                StandardMessages.DisplayValidationError("Last Name");
                isValid = false;
            }

            return(isValid);
        }
Example #2
0
        static void Main(string[] args)
        {
            StandardMessages.WelcomeMessage();

            // Create user
            Person user = PersonDataCapture.Capture();

            // Validate user information
            bool isValidUser = PersonValidator.Validate(user);

            if (isValidUser == false)
            {
                StandardMessages.EndApplication();
                return;
            }

            // Generate user ID
            string userId = AccountGenerator.CreateAccount(user);

            Console.WriteLine($"Your unqiue user ID is {userId}");
            StandardMessages.EndApplication();
        }