/// <summary> /// 修改 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateHotStyle(HotStyleModel model) { return(GoodsClient.Send <UpdHotProductModelResponse>(new UpdHotProductModel { UpdDto = Mapper.Map <HotStyleModel, GetHotProductDto>(model) }).DoFlag); }
/// <summary> /// 查询单个 /// </summary> /// <param name="SysNo"></param> /// <returns></returns> public HotStyleModel QueryHotStyleModel(int SysNo) { var model = new HotStyleModel(); var response = GoodsClient.Send <GetHotProductModelResponse>(new GetHotProductModel { Id = SysNo }); if (response.DoFlag && response.Dto != null) { model = Mapper.Map <GetHotProductDto, HotStyleModel>(response.Dto); } return(model); }
//新增 public JsonResult AddHotStyle(HotStyleModel model) { var result = new BaseResponse() { DoFlag = false, DoResult = "添加失败,请稍后重试... ..." }; #region 参数验证 var hotstyleModel = HotStyleClient.Instance.QueryHotStylePageList(new HotStyleRefer() { Search = new HotStyleModel() { ProductId = model.ProductId } }); if (hotstyleModel.List.Any()) { result.DoResult = "此商品ID已存在"; return(Json(result)); } //if (string.IsNullOrEmpty(model.LogiscticId)) //{ // result.DoResult = "请填写配送商ID"; // return Json(result); //} //if (string.IsNullOrEmpty(model.LogiscticCompanyName)) //{ // result.DoResult = "请填写配送商名称"; // return Json(result); //} //model.RowCreateDate = DateTime.Now; //model.IsDel = 0; #endregion try { var flag = HotStyleClient.Instance.AddHotStyle(new HotStyleModel { ProductId = model.ProductId, Sort = 0, ApplyPlace = model.ApplyPlace, StartTime = model.StartTime, EndTime = model.EndTime, HotDescription = model.HotDescription, PictureUrl = model.PictureUrl, PictureUrlTrans = model.PictureUrlTrans, CreateBy = 888, CreateDate = DateTime.Now, UpdateBy = 888, UpdateDate = DateTime.Now, IsDeleted = false, IsEnable = model.IsEnable, HotTag = model.HotTag, CountryId = model.CountryId, ApplyLabel = model.ApplyLabel ?? "", IsExpire = 0 }); if (flag) { result.DoFlag = true; result.DoResult = "添加成功"; } } catch (Exception ex) { result.DoResult = "添加异常"; } return(Json(result)); }
//修改 public JsonResult UpdHotStyle(HotStyleModel model) { var result = new BaseResponse() { DoFlag = false, DoResult = "更新失败 ,请稍后重试……" }; #region 参数验证 //if (string.IsNullOrEmpty(model.LogiscticId)) //{ // result.DoResult = "请填写配送商ID"; // return Json(result); //} //if (string.IsNullOrEmpty(model.LogiscticCompany)) //{ // model.LogiscticCompany = ""; //} //if (string.IsNullOrEmpty(model.LogiscticCompanyName)) //{ // result.DoResult = "请填写配送商名称"; // return Json(result); //} //model.RowCreateDate = DateTime.Now; //model.IsDel = 0; #endregion try { var updModel = new HotStyleModel { Id = model.Id, ProductId = model.ProductId, ApplyPlace = model.ApplyPlace, StartTime = model.StartTime, EndTime = model.EndTime, HotDescription = model.HotDescription, PictureUrl = model.PictureUrl, PictureUrlTrans = model.PictureUrlTrans, CreateBy = 888, CreateDate = DateTime.Now, UpdateBy = 888, UpdateDate = DateTime.Now, IsDeleted = false, IsEnable = model.IsEnable, HotTag = model.HotTag, CountryId = model.CountryId, ApplyLabel = model.ApplyLabel ?? "", IsExpire = 0 }; var flag = HotStyleClient.Instance.UpdateHotStyle(updModel); if (flag) { result.DoFlag = true; result.DoResult = "更新成功"; } } catch (Exception ex) { result.DoResult = "更新异常"; } return(Json(result)); }