public ActionResult SetActionRoleInfo() { int RoleinfoId = int.Parse(Request["actionId"]); List <int> list = new List <int>(); string[] allkeys = Request.Form.AllKeys;//获取所有表单中Name属性的值 foreach (string key in allkeys) { if (key.StartsWith("cba_")) { string k = key.Replace("cba_", ""); list.Add(int.Parse(k)); } } if (ActionInfoService.SetActionRoleInfo(RoleinfoId, list)) { return(Content("ok")); } else { return(Content("no")); } }
//设置权限角色 public ActionResult SetActionRole() { int actionId = Request["actionInfoId"] == null?0:int.Parse(Request["actionInfoId"]); string [] allKeys = Request.Form.AllKeys; List <int> roleIdlist = new List <int>(); foreach (var Key in allKeys) { if (Key.StartsWith("CKB_")) { roleIdlist.Add(int.Parse(Request[Key])); } } if (ActionInfoService.SetActionRoleInfo(actionId, roleIdlist)) { return(Content("ok")); } else { return(Content("no")); } }