コード例 #1
0
        public async Task <ValidationContext <GetPagedIssueQueryResult> > Handle(GetPagedIssueQuery request, CancellationToken cancellationToken)
        {
            var resultContext = new ValidationContext <GetPagedIssueQueryResult>();

            var includedStatuses = new List <IssueStatuses> {
                IssueStatuses.InProgress,
                IssueStatuses.Pending
            };

            if (request.IncludeResolved)
            {
                includedStatuses.Add(IssueStatuses.Resolved);
            }

            var pagedResponse = await _issueService.GetPaged(request.Page, request.PageSize, includedStatuses);

            var issueViewModels = _mapper.Map <List <IssueListDetailModel> >(pagedResponse.Items);

            resultContext.Data = new GetPagedIssueQueryResult
            {
                Page       = pagedResponse.Page,
                PageSize   = pagedResponse.PageSize,
                TotalPages = pagedResponse.TotalPages,
                Items      = issueViewModels
            };

            return(resultContext);
        }
コード例 #2
0
 private void GivenAQuery(bool includeResolved)
 {
     _query = new GetPagedIssueQuery
     {
         IncludeResolved = includeResolved
     };
 }
コード例 #3
0
        public async Task <ActionResult <GetPagedIssueQueryResult> > GetPagedIssues([FromQuery] GetPagedIssueQuery query)
        {
            var response = await _mediator.Send(query);

            return(response.ToOkIfValidResult());
        }