public void SaveVShopSetting(WXshopInfo wxShop) { if (GetVShopSetting(wxShop.ShopId) == null) { AddVShopSetting(wxShop); } else { UpdateVShopSetting(wxShop); } }
void AddVShopSetting(WXshopInfo vshopSetting) { if (string.IsNullOrEmpty(vshopSetting.AppId)) { throw new Mall.Core.MallException("微信AppId不能为空!"); } if (string.IsNullOrEmpty(vshopSetting.AppSecret)) { throw new MallException("微信AppSecret不能为空!"); } DbFactory.Default.Add(vshopSetting); }
void UpdateVShopSetting(WXshopInfo vshopSetting) { var wxShop = GetVShopSetting(vshopSetting.ShopId); if (string.IsNullOrEmpty(vshopSetting.AppId)) { throw new Mall.Core.MallException("微信AppId不能为空!"); } if (string.IsNullOrEmpty(vshopSetting.AppSecret)) { throw new MallException("微信AppSecret不能为空!"); } wxShop.ShopId = vshopSetting.ShopId; wxShop.AppId = vshopSetting.AppId; wxShop.AppSecret = vshopSetting.AppSecret; wxShop.FollowUrl = vshopSetting.FollowUrl; DbFactory.Default.Update(wxShop); }