public async Task <ApiResult> GetListPages(int page, string key = null) { Expression <Func <Column, bool> > whereExpression = null; if (!string.IsNullOrEmpty(key)) { whereExpression = d => d.Title.Contains(key); } var res = await _columnService.GetPagesAsync(page, 15, whereExpression, d => d.Id, false); return(new ApiResult(data: new { count = res.TotalItems, items = res.Items })); }
public override async Task <ApiResult> GetListPages([FromQuery] KeyListSiteQuery keywordListSiteQuery) { Expression <Func <Column, bool> > whereExpression = null; if (keywordListSiteQuery.SiteId > 0) { whereExpression = d => d.SiteId == keywordListSiteQuery.SiteId; } if (!string.IsNullOrEmpty(keywordListSiteQuery.Key)) { whereExpression = d => d.Title.Contains(keywordListSiteQuery.Key); } var res = await _columnService.GetPagesAsync(keywordListSiteQuery.Page, keywordListSiteQuery.Limit, whereExpression, d => d.Id, false); return(new ApiResult(data: new { count = res.TotalItems, items = res.Items })); }