コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public override async Task <IHttpActionResult> Index([FromUri] HorseIndexRequest request)
 {
     return(await DoIndexAsync(request));
 }