public async Task <bool> Handle(ChangeCircleOwnerCommand request, CancellationToken cancellationToken) { var circle = await _circleRepository.GetCircleWithUsersAsync(request.CircleId); if (circle == null) { throw new ClientException("操作失败", new List <string> { $"Circle {request.CircleId} dos not exist." }); } var myId = Guid.Parse(_httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value); circle.SetOwner(myId, request.UserId); if (await _circleRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken)) { await SendCircleOwnerChangedEventAsync(circle, myId); return(true); } throw new ApplicationException("操作失败"); }