protected async Task <SearchResponse <Horse> > GetItemsAsync(HorseIndexRequest request, Expression <Func <Horse, bool> > whereClause) { var orderBy = GetOrderBy(request.SortColumn, request.IsDescending); var result = await repository.GetPagedListAsync(request.Page, whereClause, orderBy); var response = new SearchResponse <Horse>(result.ToList(), result.TotalItemCount, result.PageSize); return(response); }
protected override async Task <HorseIndexResponse> GetItemsAsync(HorseIndexRequest request) { var search = request.Search; Expression <Func <Horse, bool> > whereClause = r => search == null || search == "" || r.Name.Contains(search); var items = await GetItemsAsync(request, whereClause); return(new HorseIndexResponse(items.Items, items.RecordCount, items.RowsPerPage)); }
public override async Task <IHttpActionResult> Index([FromUri] HorseIndexRequest request) { return(await DoIndexAsync(request)); }