예제 #1
0
        public async Task <IActionResult> GetArtifacts(string ids        = null, string title = null,
                                                       ArtifactType?type = null, ArtifactStatus?status = null, int?memberId = null,
                                                       int?communityId   = null, int page = 1, int pageSize = 20)
        {
            var criteriaModel = new ArtifactCriteriaModel
            {
                Ids         = ids?.SafeSplit(),
                Title       = title,
                Type        = type,
                Status      = status,
                MemberId    = memberId,
                CommunityId = communityId,
                Page        = page,
                PageSize    = pageSize
            };
            var validationResults = _criteriaValidator.Validate(criteriaModel);

            if (validationResults.IsValid)
            {
                return(Ok(await _artifactService.GetArtifacts(criteriaModel).ConfigureAwait(false)));
            }

            validationResults.AddToModelState(ModelState, null);

            return(BadRequest(ModelState));
        }