//禁启用菜单 public ActionResult <Message> UpdateModuleState() { string[] idsStr = Request.Form["ids"]; string stateStr = Request.Form["state"]; byte state = 1; if (Validator.IsNumbers(stateStr)) { state = byte.Parse(stateStr); } var stateDes = state == 1 ? "启用" : "禁用"; var msg = new Message(10, $"{stateDes}失败"); var idsInt = new List <int>(); if (idsStr != null && idsStr.Count() > 0) { foreach (var id in idsStr) { if (Validator.IsNumbers(id)) { idsInt.Add(int.Parse(id)); } } msg = CMSAdminBO.UpdateModuleState(idsInt, state); } else { msg.Code = 101; msg.Msg = $"请选择要{stateDes}的菜单"; } return(new JsonResult(msg)); }