public JsonResult Save(ShopShipper model) { if (model.RegionId <= 0) { ModelState.AddModelError("Latitude", "请选择发货地区"); } if (!model.Latitude.HasValue || !model.Longitude.HasValue) { ModelState.AddModelError("Latitude", "请定位发货地址"); } if (ModelState.IsValid) { bool isadd = false; if (model.Id == 0) { isadd = true; } model.ShopId = CurShopId; if (isadd) { ShopShippersApplication.Add(CurShopId, model); } else { var curdata = ShopShippersApplication.GetShopShipper(CurShopId, model.Id); if (curdata == null) { throw new HimallException("错误参数"); } UpdateModel(curdata); ShopShippersApplication.Update(CurShopId, curdata); } return(Json(new Result() { success = true, msg = "保存发收货地址成功" })); } else { return(Json(new Result() { success = false, msg = "数据参数错误" })); } }