// technical validation carried out at the application level private void Validate(NewAccount account) { if (!account.Email.Contains("@")) throw new ValidationFailure("Not a valid email address"); if (account.Email.Length >= 50) throw new ValidationFailure("Email address must be less than 50 characters"); if (account.Nickname.Length >= 25) throw new ValidationFailure("Nickname must be less than 25 characters"); if (String.IsNullOrWhiteSpace(account.Email)) throw new ValidationFailure("You must supply an email"); if (String.IsNullOrWhiteSpace(account.Nickname)) throw new ValidationFailure("You must supply a Nickname"); }
public void RecommendAFriend(int referrerId, NewAccount friendsAccountDetails) { Validate(friendsAccountDetails); // ... }
public void RecommendAFriend(int referrerId, NewAccount friendsAccountDetails) { Validate(friendsAccountDetails); // ... }