コード例 #1
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public Result Add(DicItemEditParam p)
        {
            var model = new DicItem
            {
                Code    = p.Code,
                Comment = p.Comment,
                Dic     = new Dic {
                    ID = p.PID
                },
                ID     = 0,
                Name   = p.Name,
                Sort   = p.Sort,
                Status = p.Status
            };
            var result = dal.Add(model);

            if (result)
            {
                return(new Result(200, "添加成功!"));
            }
            else
            {
                return(new Result(300, "添加失败!"));
            }
        }
コード例 #2
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public Result Edit(DicItemEditParam p)
        {
            var model = dal.Get(p.ID);

            if (model == null)
            {
                return(new Result(300, "数据获取失败!"));
            }
            model.Code    = p.Code;
            model.Comment = p.Comment;
            model.Dic     = new Dic {
                ID = p.PID
            };
            model.Name   = p.Name;
            model.Sort   = p.Sort;
            model.Status = p.Status;
            var result = dal.Edit(model);

            if (result)
            {
                return(new Result(200, "编辑成功!"));
            }
            else
            {
                return(new Result(300, "编辑失败!"));
            }
        }
コード例 #3
0
ファイル: DicItemController.cs プロジェクト: jzxyouok/ExtApp
        public JsonResult Edit(DicItemEditParam p)
        {
            var result = bll.Edit(p);

            return(Json(result));
        }