Exemplo n.º 1
0
        /// <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));
        }