public JsonResult GetDataPager(DataTableSearchModel searchInput) { if (searchInput.ActionType == "group_action") { if (string.IsNullOrEmpty(searchInput.CustomActionValue) || searchInput.id == null || searchInput.id.Count == 0) { return(Json(new { actionType = searchInput.ActionType, customActionStatus = false, customActionMsg = "无效参数" })); } try { _reportAppService.BatchUpdateStatusAsync(searchInput.id, bool.Parse(searchInput.CustomActionValue)); return(Json(new { actionType = searchInput.ActionType, customActionStatus = true, customActionMsg = "" })); } catch (Exception e) { return(Json(new { actionType = searchInput.ActionType, customActionStatus = false, customActionMsg = "无效参数" })); } } int pageIndex = 0; GetReportInput defaultInput = new GetReportInput() { MaxResultCount = CarFactoryConsts.MaxPageSize, SkipCount = pageIndex * CarFactoryConsts.MaxPageSize, Sorting = "CreationTime", Page = pageIndex + 1 }; if (searchInput != null && searchInput.ActionType == "filter") { defaultInput.Id = searchInput.FilterId; defaultInput.BeginDate = searchInput.FilterDateFrom; defaultInput.EndDate = searchInput.FilterDateTo; defaultInput.FilterText = searchInput.FilterName ?? ""; defaultInput.Status = searchInput.FilterStatus; } var list = _reportAppService.GetPagedReportsAsync(defaultInput).Result; var pagedProducts = new StaticPagedList <ReportListDto>(list.Items, defaultInput.Page.Value, defaultInput.MaxResultCount, list.TotalCount); var viewModelList = GenerateTablePagerData(pagedProducts, "/admin/reports/detail/"); return(Json(new { draw = Request.Form["draw"], recordsTotal = pagedProducts.TotalItemCount, recordsFiltered = pagedProducts.Count, data = viewModelList }, JsonRequestBehavior.AllowGet)); }
// GET: Qualification public ActionResult List(int?page) { int pageIndex = ((page != null && page.Value >= 1) ? page.Value : 1) - 1; GetReportInput pagedInput = new GetReportInput(); pagedInput.SkipCount = pageIndex * pagedInput.MaxResultCount; var reports = _reportAppService.GetPagedReportsAsync(pagedInput).Result; var pagedReports = new StaticPagedList <ReportListDto>(reports.Items, pageIndex + 1, pagedInput.MaxResultCount, reports.TotalCount); ViewBag.SeoSetting = GetSeoSetting(); return(View(pagedReports)); }