public JsonResult WebAppAdd(Models.api_webapp api_Webapp) { api_Webapp.mod_date = DateTime.Now; if (api_Webapp.id > 0) { dbwebapp.Update(api_Webapp); } else { dbwebapp.Insert(api_Webapp); } var m = dbwebapp.SaveChanges(); if (m > 0) { return(Json(new { success = true, message = "保存成功", data = m }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = false, message = "保存失败", }, JsonRequestBehavior.AllowGet)); }
public JsonResult dataSave(Models.api_webapp entity) { try { if (entity != null) { entity.mod_date = DateTime.Now; } if (entity.id <= 0) { dbhelper.Insert(entity); dbhelper.SaveChanges(); dbhelper.SaveChanges(); } else { dbhelper.Update(entity); dbhelper.SaveChanges(); } return(Json(new { access = true })); } catch (Exception exp) { return(Json(new { access = false, msg = exp.Message })); } }
public JsonResult Del(int id) { try { Models.api_webapp item = dbhelper.FindById(id); dbhelper.Delete(item); dbhelper.SaveChanges(); return(Json(new { access = true })); } catch (Exception exp) { return(Json(new { access = false, msg = exp.Message })); } }
public ActionResult Edit(int id) { Models.api_webapp entity = dbhelper.FindById(id); if (entity == null) { entity = new Models.api_webapp(); //新增; ViewBag.entity = entity; } else { ViewBag.entity = entity; } return(View());// }