/// <summary> /// 新增/修改 /// </summary> /// <param name="onelevel"></param> /// <returns></returns> public BaseResult Update(onelevel onelevel) { result.code = 0; result.msg = "操作成功"; if (onelevel.id == 0) { var insert = dalOnelevel.Add(onelevel); if (insert <= 0) { result.code = -1; result.msg = "增加失败"; } return(result); } var update = dalOnelevel.Update(onelevel); if (update <= 0) { result.code = -1; result.msg = "修改失败"; } return(result); }
/// <summary> /// 新增数据 /// </summary> /// <param name="onelevel"></param> /// <returns></returns> public int Add(onelevel onelevel) { return((int)dbContext.Insert <onelevel>(() => new onelevel() { name = onelevel.name })); }
/// <summary> /// 更新数据 /// </summary> /// <param name="onelevel"></param> /// <returns></returns> public int Update(onelevel onelevel) { return(dbContext.Update <onelevel>(p => p.id == onelevel.id, p => new onelevel() { name = onelevel.name })); }
public JsonResult Addone(onelevel onelevel) { return(Json(bllOnelevel.Update(onelevel))); }