示例#1
0
        public SolutionEx BySolution(string solutionId)
        {
            return(GetInternal(() =>
            {
                var retval = new SolutionEx
                {
                    Solution = _solutionDatastore.ById(solutionId),
                    TechnicalContact = _technicalContactDatastore.BySolution(solutionId).ToList(),
                    ClaimedCapability = _claimedCapabilityDatastore.BySolution(solutionId).ToList(),
                    ClaimedStandard = _claimedStandardDatastore.BySolution(solutionId).ToList()
                };

                // populate Evidence + Review
                retval.ClaimedCapabilityEvidence = retval.ClaimedCapability
                                                   .SelectMany(cc => _claimedCapabilityEvidenceDatastore.ByClaim(cc.Id))
                                                   .SelectMany(x => x)
                                                   .ToList();
                retval.ClaimedCapabilityReview = retval.ClaimedCapabilityEvidence
                                                 .SelectMany(cce => _claimedCapabilityReviewsDatastore.ByEvidence(cce.Id))
                                                 .SelectMany(x => x)
                                                 .ToList();
                retval.ClaimedStandardEvidence = retval.ClaimedStandard
                                                 .SelectMany(cs => _claimedStandardEvidenceDatastore.ByClaim(cs.Id))
                                                 .SelectMany(x => x)
                                                 .ToList();
                retval.ClaimedStandardReview = retval.ClaimedStandardEvidence
                                               .SelectMany(cse => _claimedStandardReviewsDatastore.ByEvidence(cse.Id))
                                               .SelectMany(x => x)
                                               .ToList();

                return retval;
            }));
        }
        public virtual IActionResult ApiCapabilitiesImplementedEvidenceByClaimByClaimIdGet([FromRoute][Required] string claimId, [FromQuery] int?pageIndex, [FromQuery] int?pageSize)
        {
            IEnumerable <IEnumerable <CapabilityEvidence> > evidences;
            int totalPages;

            try
            {
                evidences = _datastore.ByClaim(claimId);
                evidences = _datastore.GetPagingValues(pageIndex, pageSize, evidences, out totalPages);
            }
            catch (Crm.CrmApiException ex)
            {
                return(StatusCode((int)ex.HttpStatus, ex.Message));
            }

            return(new ObjectResult(new PaginatedListIEnumerableCapabilitiesImplementedEvidence()
            {
                Items = evidences.ToList(),
                TotalPages = totalPages,
                PageSize = pageSize ?? Paging.DefaultPageSize,
                PageIndex = pageIndex ?? Paging.DefaultIndex,
            }));
        }