public IQueryable <Shape> GetSortedFilteredList(ShapeListInput input, out int itemCount) { return(_shapeRepo.GetAll().AsNoTracking().FilterSortAndGetPage( config: input.AsFilterSortPageConfig(), args: input, itemCount: out itemCount)); }
public IActionResult GetList([FromQuery] ShapeListInput input) { return(Ok(_shapeService .GetSortedFilteredList(input, out var itemCount) .Select(ShapeListViewModel.GetFromShape) .ToPagedResults(resultCount: itemCount))); }
public static IFilterSortPageConfig <Shape, ShapeListInput, int> AsFilterSortPageConfig(this ShapeListInput input) => new FilterSortPageConfigBuilder <Shape, ShapeListInput, int>( primaryKeySelector: n => n.Id, pageSize: input.pageSize, pageNumber: input.pageNumber) .WithFiltering(FILTERS) .WithSorting( sortCriteria: input.sortCriteria ?? DEFAULT_SORT_CRITERIA, orderByStringKeySelectors: ORDER_BY_STRING, orderByIntKeySelectors: ORDER_BY_INT ) .Build();