public static bool Validate(Person person) { if (string.IsNullOrEmpty(person.FirstName)) { StandardMessage.DisplayValidationError("first name"); return(false); } if (string.IsNullOrEmpty(person.LastName)) { StandardMessage.DisplayValidationError("last name"); return(false); } return(true); }
static void Main(string[] args) { StandardMessage.WelcomeMessage(); Person user = PersonDataCapture.Capture(); bool isUserValid = PersonValidator.Validate(user); if (isUserValid == false) { StandardMessage.EndMessage(); return; } AccountGenerator.CreateUserAccount(user); StandardMessage.EndMessage(); }
public static bool Validate(Person person) { //Check to be sure the first and last name are valid if (string.IsNullOrWhiteSpace(person.FirstName)) { StandardMessage.DisplayValidationError("first name"); return(false); } if (string.IsNullOrWhiteSpace(person.LastName)) { StandardMessage.DisplayValidationError("last name"); return(false); } return(true); }