public static Person Capture() { Person output = new Person(); Console.WriteLine("What is your first name?"); output.FirstName = Console.ReadLine(); Console.WriteLine("What is your last name?"); StandardMessages.EndApplication(); return(output); }
private static void Main(string[] args) { StandardMessages.WelcomeMessage(); Person user = PersonDataCapture.Capture(); //check for null bool isUserValide = PersonValidator.ValidatePerson(user); if (!isUserValide) { StandardMessages.EndApplication(); return; } AccountGenerator.CreateAccount(user); StandardMessages.EndApplication(); }
public static bool ValidatePerson(Person person) { if (string.IsNullOrWhiteSpace(person.FirstName)) { StandardMessages.DisplayValidatorError("first name"); Console.WriteLine("Invalid firstname"); StandardMessages.EndApplication(); return(false); } if (string.IsNullOrWhiteSpace(person.LastName)) { StandardMessages.DisplayValidatorError("last name"); StandardMessages.EndApplication(); return(false); } return(true); }