/// <summary>
        /// 新增/修改
        /// </summary>
        /// <param name="onelevel"></param>
        /// <returns></returns>
        public BaseResult Update(threelevel threelevel)
        {
            result.code = 0;
            result.msg  = "操作成功";
            if (threelevel.id == 0)
            {
                var insert = dalThreelevel.Add(threelevel);
                if (insert <= 0)
                {
                    result.code = -1;
                    result.msg  = "增加失败";
                }
                return(result);
            }

            var update = dalThreelevel.Update(threelevel);

            if (update <= 0)
            {
                result.code = -1;
                result.msg  = "修改失败";
            }

            return(result);
        }
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="threelevel"></param>
 /// <returns></returns>
 public int Update(threelevel threelevel)
 {
     return(dbContext.Update <threelevel>(p => p.id == threelevel.id, p => new threelevel()
     {
         name = threelevel.name,
         definition = threelevel.definition,
         according = threelevel.according,
         origin = threelevel.origin,
         two_id = threelevel.two_id
     }));
 }
 /// <summary>
 /// 新增数据
 /// </summary>
 /// <param name="threelevel"></param>
 /// <returns></returns>
 public int Add(threelevel threelevel)
 {
     return((int)dbContext.Insert <threelevel>(() => new threelevel()
     {
         name = threelevel.name,
         definition = threelevel.definition,
         according = threelevel.according,
         origin = threelevel.origin,
         two_id = threelevel.two_id,
         state = 1
     }));
 }
Beispiel #4
0
 public JsonResult Addthree(threelevel threelevel)
 {
     return(Json(bllThreelevel.Update(threelevel)));
 }