コード例 #1
0
        public async Task <ApiResult> Delete([FromUri] string id, CancellationToken cancelToken)
        {
            if (Authorization == null)
            {
                return(new ApiResult(APIResultCode.Unknown, APIResultMessage.TokenNull));
            }
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new NotImplementedException("活动Id信息为空!");
            }

            var user = _tokenRepository.GetUser(Authorization);

            if (user == null)
            {
                return(new ApiResult(APIResultCode.Unknown, APIResultMessage.TokenError));
            }

            await _activityRepository.DeleteAsync(new Domain.Dto.Store.ActivityDto
            {
                ID              = id,
                OperationTime   = DateTimeOffset.Now,
                OperationUserId = user.Id.ToString()
            }, cancelToken);

            return(new ApiResult());
        }