public static bool Validate(Person person) { if (string.IsNullOrWhiteSpace(person.FirstName)) { StandardMessages.DisplayValidationError("first name"); return(false); } if (string.IsNullOrWhiteSpace(person.LastName)) { StandardMessages.DisplayValidationError("last name"); return(false); } return(true); }
private static string GetName(string sentence) { while (true) { try { StandardMessages.PrintMessage(sentence, NewLineCharacter.no); return(StandardMessages.ReadLine()); } catch (IOException) { StandardMessages.PrintMessage("Invalid entry, please try again"); continue; } } }