コード例 #1
0
        public async Task <IActionResult> Get([FromQuery] IssuesFilter filter)
        {
            if (string.IsNullOrEmpty(filter.ProjectId + filter.VersionId))
            {
                return(ErrorResult("ProjectId or versionId not found"));
            }

            if (!string.IsNullOrEmpty(filter.VersionId) && !string.IsNullOrEmpty(filter.ProjectId))
            {
                return(ErrorResult("You only need to specify the projectId or versionId"));
            }

            ServiceResult <PagedList <IssueModel> > result;

            if (!string.IsNullOrEmpty(filter.VersionId))
            {
                result = await _issuesService.GetByVersionId(filter.VersionId, CurrentUserId, filter.PageSize, filter.PageNumber);
            }
            else
            {
                result = await _issuesService.GetByProjectId(filter.ProjectId, CurrentUserId, filter.PageSize, filter.PageNumber);
            }
            return(ModelResult(result));
        }