static void Main(string[] args) { StandardMessages.WelcomeMessage(); Person user = PersonDataCapture.Capture(); if (!PersonValidator.Validate(user)) { StandardMessages.EndApplication(); return; } AccountGenerator.CreateAccount(user); StandardMessages.EndApplication(); }
public static bool Validate(Person person) { if (string.IsNullOrWhiteSpace(person.FirstName)) { StandardMessages.DisplayValidatorErrorFor("First Name"); return(false); } if (string.IsNullOrWhiteSpace(person.LastName)) { StandardMessages.DisplayValidatorErrorFor("Last Name"); return(false); } return(true); }
public static bool Validate(Person person) { // Checks to be sure the first and last names are valid if (string.IsNullOrWhiteSpace(person.FirstName)) { StandardMessages.DisplayValidationError("first name"); return(false); } if (string.IsNullOrWhiteSpace(person.LastName)) { StandardMessages.DisplayValidationError("last name"); return(false); } return(true); }
static void Main(string[] args) { StandardMessages.WelcomeMessage(); // We should not have this tight couple thing - use DI / Interfaces Person user = PersonDataCapture.Capture(); bool isUserValid = PersonValidator.Validate(user); if (isUserValid == false) { StandardMessages.EndApplication(); return; } AccountGenerator.CreateAccount(user); //Console.ReadLine(); StandardMessages.EndApplication(); }