public async Task <IDataResponse <string> > LoginAsync(LoginModel loginModel) { var account = await _dal.GetAsync(x => x.Email == loginModel.Email); if (HashingHelper.VerifyPasswordHash(loginModel.Password, account.PasswordHash, account.PasswordSalt)) { return(await LoginAsync(account)); } await _loginHistory.InsertAsync(new AccountLoginHistory { AccountId = account.Id, Date = DateTime.Now, IsSuccess = false, IpAddress = _helper.GetIpAddress(), Message = AccountMessage.PasswordWrong.Left(255) }); return(new ErrorDataResponse <string>(null, AccountMessage.PasswordWrong)); }
public async Task <bool> AnyAsync(int id) => await _dal.GetAsync(id) != null;