Beispiel #1
0
        public async Task <List <ComponentResource> > Handle(GetAllComponentsQuery request, CancellationToken cancellationToken)
        {
            var components = await _dataContext.Components
                             .Page(request.Page, request.Limit)
                             .ComponentOrder()
                             .AsNoTracking()
                             .ToListAsync(cancellationToken);

            return(components.Select(ComponentResource.FromComponent).ToList());
        }
        public async Task <ActionResult <PagedResponse <ComponentResource> > > GetComponentsAsync([FromQuery] GetAllComponentsQuery componentQuery)
        {
            var componentResource = await _mediator.Send(componentQuery);

            if (componentResource == null)
            {
                return(NotFound());
            }

            return(PageService.CreatePaginatedResponse(componentQuery.Page, componentQuery.Limit, componentResource));
        }