// // GET: /Permission/ public ViewResult Index(int?page) { var pageIndex = (page ?? 1) - 1; var pageSize = 5; int totalCount; Specification <Permission> c = SpecificationBuilder.BuildSpecification <Permission>(BuildCondition()); var permissions = permissionRepository.AllMatching(c, pageIndex, pageSize, "CreatedOn", false, out totalCount); var permissionsAsIPagedList = new StaticPagedList <Permission>(permissions, pageIndex + 1, pageSize, totalCount); ViewBag.OnePageOfpermissions = permissionsAsIPagedList; return(View()); }