public async Task <IActionResult> Index([FromServices] IProductsRepository repository, [FromQuery] SieveModel model, [FromServices] ISieveProcessor sieveProcessor) { var queryable = repository.AsQueryableWithDependencies(); queryable = sieveProcessor.Apply(model, queryable, applySorting: false, applyPagination: false); var totalCount = await repository.ProcessQueryCountAsync(queryable); queryable = sieveProcessor.Apply(model, queryable, applyFiltering: false); var items = await repository.ProcessQueryAsync(queryable); var response = new HomeIndexViewModel { Products = items, TotalCount = totalCount, Page = model.Page ?? 1, PageSize = model.PageSize ?? int.MaxValue }; return(View(response)); }