//更新 public ActionResult Update_targetlocation() { lp_targetlocation model = new lp_targetlocation(); model.tlid = Request["id"]; model.lat = decimal.Parse(Request["lat"]); model.lng = decimal.Parse(Request["lng"]); model.tlname = Request["tlname"]; bool isexits = tldal.Exists("tlstatus<>3 and tlname=@0 and tlid<>@1", model.tlname, model.tlid); if (isexits) { return(Json(new { success = false, msg = "存在同名的目标地址!" })); } int exec = tldal.Update(model, new string[] { "lat", "lng", "tlname" }); if (exec > 0) { return(Json(new { success = true, msg = "更新成功!" })); } else { return(Json(new { success = false, msg = "更新失败!" })); } }
//获取来源model public ActionResult Get_TModel() { object id = Request["id"]; lp_targetlocation model = tldal.SingleOrDefault(id); return(Json(model)); }
//新增目标地址 public ActionResult ADD_targetlocation() { lp_targetlocation model = new lp_targetlocation(); model.tlid = System.Guid.NewGuid().ToString(); decimal lat; decimal.TryParse(Request["lat"], out lat); model.lat = lat; decimal lng; decimal.TryParse(Request["lat"], out lng); model.lng = lng; model.tlname = Request["tlname"]; model.createtime = DateTime.Now; model.tlstatus = 0; bool isexits = tldal.Exists("tlstatus<>3 and tlname=@0 ", model.tlname); if (isexits) { return(Json(new { success = false, msg = "存在同名的目标地址!" })); } object exec = tldal.Add(model); if (exec != null) { return(Json(new { success = true, msg = "新增成功!" })); } else { return(Json(new { success = false, msg = "新增失败!" })); } }