/// ///保存一个商品 public RES Save(YunCommodity newData) { var newVal = JSON.ToObject <YunForm>(JSON.ToJson(newData)); var db = ModelEF.GetInst(); var oldVal = db.YunForms.FirstOrDefault(p => p.ID == newVal.ID); if (null == oldVal) { newVal.InitialDateTime(); var inst = db.YunForms.Add(newVal); db.SaveChanges(); return(RES.New.SetAsOK(newVal)); } else { var properties = newVal.GetType().GetProperties().ToList(); properties.ForEach(p => { var targetProperty = oldVal.GetType().GetProperty(p.Name); if (null != targetProperty && targetProperty.CanWrite) { targetProperty.SetValue(oldVal, p.GetValue(newVal)); } }); db.SaveChanges(); return(RES.New.SetAsOK(oldVal)); } }
public RES LoadList(string filter = null) { return(YunCommodity.GetInst().LoadList((int)ENUM.ServiceType.云商品)); }
///检测关联订单信息 public RES RefOrderCount(string keyword) { return(YunCommodity.GetInst().RefOrderCount(keyword)); }
/// ///上架 public RES OnShelves(string keyword) { return(YunCommodity.GetInst().OnShelves(keyword)); }
///删除商品 public RES Remove(string keyword) { return(YunCommodity.GetInst().Remove(keyword)); }
/// ///保存一个商品 public RES Save(string data) { var commodity = JSON.ToObject <YunCommodity>(data); return(YunCommodity.GetInst().Save(commodity)); }
///检测商品是否存在 public RES Exsit(string keyword) { return(YunCommodity.GetInst().Exsit(keyword)); }