예제 #1
0
        public BannerItem AddItem(BannerItemAddCommand command)
        {
            if (BannerItems == null)
            {
                BannerItems = new List <BannerItem>();
            }
            BannerItem bannerItem = new BannerItem();

            bannerItem.Init(command);
            BannerItems.Add(bannerItem);

            AddEvent(this.ToAddOrChangCacheEvent());
            return(bannerItem);
        }
예제 #2
0
        public BannerItem ChangeItem(BannerItemChangeCommand command)
        {
            if (BannerItems == null)
            {
                BannerItems = new List <BannerItem>();
            }
            BannerItem bannerItem = BannerItems.FirstOrDefault(p => p.Id == command.Id);

            if (bannerItem == null)
            {
                throw new Exception("BannerItem not found.");
            }
            bannerItem.Change(command);

            AddEvent(this.ToAddOrChangCacheEvent());
            return(bannerItem);
        }