/// <summary> /// 增加菜单 /// </summary> private string AddMenu(HttpContext context) { //================必填===================== string mpid = context.Request.Params["mpid"]; string menuname = context.Request.Params["menuname"]; string menuico = context.Request.Params["menuico"]; string menuurl = context.Request.Params["menuurl"]; string msort = context.Request.Params["msort"]; SysMenuModel model = new SysMenuModel(); //model.mid = int.Parse(mid); model.menuName = menuname; model.menuIco = menuico; model.menuUrl = menuurl; model.mSort = int.Parse(msort); model.mPID = int.Parse(mpid); model.isDel = false; var jr = new JsonResultModel <int>() { IsSucceed = false, Data = 0, Msg = "增加菜单失败", RedirectUrl = string.Empty }; if (!string.IsNullOrEmpty(menuname)) { SysMenuBLL menu_bll = new SysMenuBLL(); if (menu_bll.Add(model) > 0) { jr.IsSucceed = true; jr.Msg = "增加菜单[" + menuname + "]成功"; //jr.Data = int.Parse(mid); } } return(JsonConvert.SerializeObject(jr)); }
private string AddData(HttpContext context) { string data = context.Request["model"]; SysMenu model = JsonConvert.DeserializeObject <SysMenu>(data); SysMenuBLL bll = new SysMenuBLL(); int success = 1; string msg = ""; if (model.Id == 0) { if (bll.Add(model)) { success = 0; msg = "添加成功"; } else { msg = "添加失败"; } } else { if (bll.Update(model)) { success = 0; msg = "Success"; } else { msg = "修改失败"; } } return(JsonConvert.SerializeObject(new { success = success, msg = msg })); }