public JsonResult Add(list list) { ActionResultModel<string> model = new ActionResultModel<string>(); model.isSuccess = ls.Save(list); model.respnseInfo = model.isSuccess ? "添加成功" : "添加失败"; return Json(model); }
public bool Save(list list) { var isAdd = list.id == 0; if (isAdd) { return db.Insert(list) != DBNull.Value; } else { return db.Update<list>(list, it => it.id == list.id); } }