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