public Task <IActionResult> GetEntitiesByPaged(int pageSize, int pageIndex)
 {
     return(Task.Factory.StartNew <IActionResult>(() =>
     {
         var total = TaskInfoRepository.Count(m => true);
         var rows = TaskInfoRepository.GetByPagination(m => true, pageSize, pageIndex, true,
                                                       m => m.Id).ToList();
         return Json(PaginationResult.PagedResult(rows, total, pageSize, pageIndex));
     }));
 }
 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));
     }));
 }