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); }
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); }
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); }