public SiteMessageBannerInfo GetBannerManagerInfo(string bannerId) { using (var manager = new BulletinManager()) { var entity = manager.GetBannerManagerInfo(bannerId); if (entity == null) { throw new Exception("未查询到广告数据!"); } SiteMessageBannerInfo info = new SiteMessageBannerInfo(); ObjectConvert.ConverEntityToInfo(entity, ref info); return(info); } }
public void UpdateBannerInfo(SiteMessageBannerInfo info) { if (info == null || info.BannerId <= 0) { throw new Exception("当前广告信息无效!"); } using (var manager = new BulletinManager()) { SiteMessageBanner entity = new SiteMessageBanner(); entity = manager.GetBannerManagerInfo(info.BannerId.ToString()); if (entity == null) { throw new Exception("未查询到广告信息!"); } entity.BannerIndex = info.BannerIndex; entity.BannerTitle = info.BannerTitle; entity.BannerType = info.BannerType; entity.ImageUrl = info.ImageUrl; entity.IsEnable = info.IsEnable; entity.JumpUrl = info.JumpUrl; manager.UpdateBannerInfo(entity); } }