public ActionResult AddPositionMethod() { try { //int parentID, string positionName, int creatPersonID, List<int> limltList, ref string errMsg var parentIDStr = Request["parentID"]; ///部门父节点ID var positionName = Request["positionName"]; //职位名称 var limliStr = Request["limlt"]; //该职位的权限ID集合 List <string> limltListStr = limliStr.Split(',').ToList(); List <int> limltList = new List <int>(); foreach (var item in limltListStr) { int _int = -1; if (int.TryParse(item, out _int)) { limltList.Add(_int); } } string creatPersonIDsStr = Session["id"] == null ? "" : Session["id"].ToString(); int parentID = -1; int createPersonID = -1; if (int.TryParse(parentIDStr, out parentID) && int.TryParse(creatPersonIDsStr, out createPersonID)) { string errMsg = ""; if (EmployeeManage.AddPosition(parentID, positionName, createPersonID, limltList, ref errMsg)) { return(Content("ok")); } else { return(Content(errMsg)); } } else { return(Content("请输入正确的Int类型!")); } } catch (Exception ex) { return(Content(ex.Message)); } }