public async Task HandleAsync() { List <KeyVm> deletedKeys = await keysService.DeleteUserKeysAsync(notice.KeysId, notice.UserId).ConfigureAwait(false); if (deletedKeys.Any()) { List <long> deletedKeysId = deletedKeys.Select(opt => opt.KeyId).ToList(); BlockSegmentVm segment = await BlockSegmentsService.Instance.CreateDeleteUserKeysSegmentAsync(deletedKeysId, notice.UserId, current.Node.Id).ConfigureAwait(false); BlockGenerationHelper.Instance.AddSegment(segment); } }
public async Task <Response> CreateResponseAsync() { List <KeyVm> deletedKeys = await keysService.DeleteUserKeysAsync(request.KeysId, clientConnection.UserId.GetValueOrDefault()).ConfigureAwait(false); if (deletedKeys.Any()) { List <long> deletedKeysId = deletedKeys.Select(opt => opt.KeyId).ToList(); BlockSegmentVm segment = await BlockSegmentsService.Instance.CreateDeleteUserKeysSegmentAsync( deletedKeysId, clientConnection.UserId.GetValueOrDefault(), NodeSettings.Configs.Node.Id).ConfigureAwait(false); BlockGenerationHelper.Instance.AddSegment(segment); nodeNoticeService.SendDeleteUserKeysNodeNoticeAsync(deletedKeysId, clientConnection.UserId.GetValueOrDefault()); return(new KeysResponse(request.RequestId, deletedKeys)); } return(new ResultResponse(request.RequestId, "Keys not found.", ErrorCode.ObjectDoesNotExists)); }