Esempio n. 1
0
 public JsonResult Add(list list)
 {
     ActionResultModel<string> model = new ActionResultModel<string>();
     model.isSuccess = ls.Save(list);
     model.respnseInfo = model.isSuccess ? "添加成功" : "添加失败";
     return Json(model);
 }
Esempio n. 2
0
 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);
     }
 }