public T CreateUser(string primaryEmailAddress) { if (!_emailAddressValidator.IsValid(primaryEmailAddress)) { throw new InvalidDataException("Unable to CreateUser, Email address was not in expected format."); } if (_authDb.ModelPresent <T>() && _authDb.Query <T>().Any(p => p.PrimaryEmailAddress.Equals(primaryEmailAddress))) { throw new DuplicateAccountException(); } var user = new T { PrimaryEmailAddress = primaryEmailAddress }; _authDb.Add <T>(user); _authDb.Save(); return(user); }
public bool LoginExists(TUser user) { return(_authDb.Query <TLogin>().Any(p => p.User == user)); }