/// <summary> /// 添加修改页面 /// </summary> /// <returns></returns> public ActionResult AddClassification() { int Id = string.IsNullOrEmpty(Request["Id"]) ? 0 : Int32.Parse(Request["Id"]); if (Id > 0) { model = bll.GetModel(Id); } ViewBag.model = model; DataTable tablelist = bll.GetList(" 1=1 and ParentID=0 and State=0 ").Tables[0]; List <JMP.MDL.jmp_Help_Classification> list = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_Help_Classification>(tablelist); ViewBag.list = list; return(View()); }
/// <summary> /// 添加修改方法 /// </summary> /// <returns></returns> public JsonResult AddorEidt(JMP.MDL.jmp_Help_Classification model) { object retJson = new { success = 0, msg = "操作失败" }; if (model.ID <= 0) { model.State = 0; model.CreateByID = UserInfo.Uid; model.CreateByName = UserInfo.UserName; model.CreateOn = DateTime.Now; int cg = bll.Add(model); if (cg > 0) { Logger.CreateLog("添加分类", model); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } } else { JMP.MDL.jmp_Help_Classification mo = new jmp_Help_Classification(); mo = bll.GetModel(model.ID); mo.ParentID = model.ParentID; mo.Sort = model.Sort; mo.ClassName = model.ClassName; mo.Description = model.Description; mo.Icon = model.Icon; mo.Type = model.Type; if (bll.Update(mo)) { Logger.ModifyLog("修改分类", mo, model); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } } return(Json(retJson)); }