public ViewResult Index(Department errorModel = null) { if (errorModel.DeptCode != null) { ViewBag.ErrorMessage = errorModel.DeptCode + "已被使用"; ViewBag.Id = errorModel.Id; } var model = deptManager.Index(); return(View(model)); }