Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public void Create(User user)
throw new InvalidEmailException();
if(!new Regex("^[A-Za-z]\w{6,}[A-Za-z]$").IsMatch(user.Password))
throw new InvalidPasswordException();
if(string.IsNullOrWhiteSpace(user.FirstName) || string.IsNullOrWhiteSpace(user.LastName))
throw new InvalidNameException();
var repo = new UserRepository();
repo.Create(new UserEntity{
Email = user.Email;
Password = user.Password;
FirstName = user.FirstName;
LastName = user.LastName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment