protected virtual async Task SaveLoginAttempt(AbpLoginResult <TTenant, TUser> loginResult, string tenancyName, string userNameOrEmailAddress) { using (var uow = UnitOfWorkManager.Begin(TransactionScopeOption.Suppress)) { var tenantId = loginResult.Tenant != null ? loginResult.Tenant.Id : (int?)null; using (UnitOfWorkManager.Current.SetTenantId(tenantId)) { var loginAttempt = new UserLoginAttempt { TenantId = tenantId, TenancyName = tenancyName, UserId = loginResult.User != null ? loginResult.User.Id : (long?)null, UserNameOrEmailAddress = userNameOrEmailAddress, Result = loginResult.Result, BrowserInfo = ClientInfoProvider.BrowserInfo, ClientIpAddress = ClientInfoProvider.ClientIpAddress, ClientName = ClientInfoProvider.ComputerName, }; await UserLoginAttemptRepository.InsertAsync(loginAttempt); await UnitOfWorkManager.Current.SaveChangesAsync(); await uow.CompleteAsync(); } } }
protected virtual async Task SaveLoginAttempt(SmdLoginResult <TUser> loginResult, string userNameOrEmailAddress) { var loginAttempt = new UserLoginAttempt { UserId = loginResult.User != null ? loginResult.User.Id : (long?)null, UserNameOrEmailAddress = userNameOrEmailAddress, Result = loginResult.Result, BrowserInfo = ClientInfoProvider.BrowserInfo, ClientIpAddress = ClientInfoProvider.ClientIpAddress, ClientName = ClientInfoProvider.ComputerName, }; await UserLoginAttemptRepository.InsertAsync(loginAttempt); }
protected virtual async Task SaveLoginAttempt(LoginResult <TUser> loginResult, string userNameOrEmailAddress) { var loginAttempt = new UserLoginAttempt { UserId = loginResult.User != null ? loginResult.User.Id : (long?)null, UserNameOrEmailAddress = userNameOrEmailAddress, Result = loginResult.Result, BrowserInfo = ClientInfoProvider.BrowserInfo, ClientIpAddress = ClientInfoProvider.ClientIpAddress, ClientName = ClientInfoProvider.ComputerName, }; await UserLoginAttemptRepository.InsertAsync(loginAttempt); _repositoryContext.Commit(); //await UnitOfWorkManager.Current.SaveChangesAsync(); //await uow.CompleteAsync(); }