public async Task <IActionResult> Post( [FromServices] LegacyContext context, [FromServices] IOptions <ResponseOptions> reponseOptions, [FromBody] BosaMunicipalityRequest request, CancellationToken cancellationToken = default) { if (Request.ContentLength.HasValue && Request.ContentLength > 0 && request == null) { return(Ok(new MunicipalityBosaResponse())); } var filtering = new MunicipalityBosaFilter(request); var sorting = new SortingHeader(string.Empty, SortOrder.Ascending); var pagination = new PaginationRequest(0, 1000); var filteredMunicipalities = new MunicipalityBosaQuery(context).Fetch( new FilteringHeader <MunicipalityBosaFilter>(filtering), sorting, pagination); return(Ok( new MunicipalityBosaResponse { Gemeenten = await filteredMunicipalities .Items .Select(m => new MunicipalityBosaItemResponse( m.NisCode, reponseOptions.Value.Naamruimte, m.Version, GetGemeentenamenByLanguage(m, filtering.Language))) .ToListAsync(cancellationToken), })); }
public void Then_the_items_queryable_implements_async_enumerable() { var sorting = new SortingHeader("Value", SortOrder.Ascending); var paginationInfo = new PaginationInfo(0, 0, false); var pagedQueryable = new PagedQueryable <QueryItem>(new QueryAbleWithoutAsync <QueryItem>(), paginationInfo, sorting); pagedQueryable.Items.Should().BeAssignableTo <IAsyncEnumerable <QueryItem> >(); }
public PagedQueryable(IQueryable <T> items, PaginationInfo paginationInfo, SortingHeader sortingHeader) { Items = items; PaginationInfo = paginationInfo; Sorting = sortingHeader; }