public JsonResult Get(int pageIndex, int pageSize, string pageOrder) { var list = PaymentMethods.Get(pageIndex, pageSize, pageOrder); int total = PaymentMethods.Count(); int totalPage = (int)Math.Ceiling((decimal)total / pageSize); if (pageSize > total) { pageSize = total; } if (list.Count < pageSize) { pageSize = list.Count; } JsonResult result = new JsonResult() { Data = new { TotalPages = totalPage, PageIndex = pageIndex, PageSize = pageSize, Rows = list }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return(result); }