public async Task <IActionResult> DeleteUser(int id) { var externalUser = await _externalUserRepository.TableNoTracking.FirstOrDefaultAsync(x => x.Id == id); if (externalUser != null) { _externalUserRepository.Delete(externalUser); await _unitOfWork.SaveChangesAsync(); } return(ObjectResponse.Ok()); }
/// <summary> /// 解绑第三方账号 /// </summary> public async Task UnBindExternalUser(int clientId, string userId, string loginProvider) { var externalUsers = await GetExternalUsers(clientId, userId); var externalUser = externalUsers.FirstOrDefault(c => c.ClientId == clientId && c.LoginProvider == loginProvider); if (externalUser == null) { return; } _externalUserRepository.Delete(c => c.ClientId == clientId && c.ProviderKey == externalUser.ProviderKey && c.UserId == userId); await _unitOfWork.SaveChangesAsync(); await _redisCache.KeyDeleteAsync(GetExternalUsersRedisKey(clientId, userId)); }