public Task <IActionResult> GetMenusByPaged(int pageSize, int pageIndex, string keyword) { return(Task.Factory.StartNew <IActionResult>(() => { Expression <Func <SysMenu, bool> > filter = m => true; if (!string.IsNullOrEmpty(keyword)) { filter = filter.And(m => m.Identity.Contains(keyword)); } var total = menuRepository.CountAsync(filter).Result; var rows = menuRepository.GetByPagination(filter, pageSize, pageIndex, true, m => m.Id).ToList(); return Json(PaginationResult.PagedResult(rows, total, pageSize, pageIndex)); })); }