Пример #1
0
        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);
        }
Пример #2
0
 public bool LoginExists(TUser user)
 {
     return(_authDb.Query <TLogin>().Any(p => p.User == user));
 }