public ActionResult EditParameter(ReportParameterModel model) { if (string.IsNullOrEmpty(model.Name)) { ModelState.AddModelError("Name", "请输入报表参数名称."); } if (string.IsNullOrEmpty(model.Type)) { ModelState.AddModelError("Type", "请选择报表参数类型."); } if (model.Type.Equals(Constant.REPORT_PARAM_TYPE_DROPDOWNLIST, StringComparison.InvariantCultureIgnoreCase) && string.IsNullOrEmpty(model.DataTable)) { ModelState.AddModelError("DataTable", "请输入参数数据源."); } if (ModelState.IsValid) { try { if (model.Id <= 0) { ReportService.AddParameter(model); } else { ReportService.UpdateParameter(model); } return(RedirectToAction("Edit", new { id = model.ReportId })); } catch (Exception ex) { Log.Error(ex); ViewBag.Message = ex.Message; } } EditParameter(model.ReportId, model.Id); return(View(model)); }