예제 #1
0
        public async Task <bool> IsEmailAlreadyRegistered(string email)
        {
            bool isRegistered = true;
            var  filter       = Builders <UserModel> .Filter.Eq(x => x.Email, email);

            var user = (await _collection.FindAsync <UserModel>(filter)).FirstOrDefault();;

            if (WOW.IsNull(user))
            {
                isRegistered = false;
            }
            return(isRegistered);
        }
예제 #2
0
        public async Task <UserEntity> Authenticate(string Email, string Password)
        {
            if (String.IsNullOrWhiteSpace(Email) || String.IsNullOrWhiteSpace(Password))
            {
                throw new ArgumentNullException();
            }

            UserEntity entities = null;
            var        model    = await _userRepository.Authenticate(Email, Password);

            if (!WOW.IsNull(model))
            {
                entities = _mapper.Map <UserEntity>(model);
            }
            return(entities);
        }
예제 #3
0
        public async Task <UserModel> Authenticate(string email, string password)
        {
            UserModel model  = null;
            var       filter = Builders <UserModel> .Filter.Eq(x => x.Email, email);

            var user = (await _collection.FindAsync <UserModel>(filter)).FirstOrDefault();;

            if (!WOW.IsNull(user))
            {
                if (user.Password == password)
                {
                    model = user;
                }
            }
            return(model);
        }