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