public override bool Update(CarouselEntity item, params object[] primaryKeys)
        {
            bool result = base.Update(item, primaryKeys);

            if (item.CarouselItems != null)
            {
                var carouselItemService = new CarouselItemService();
                item.CarouselItems.Each(m =>
                {
                    if (m.ActionType == Constant.ActionType.Update)
                    {
                        m.CarouselID = item.ID;
                        carouselItemService.Update(m);
                    }
                    else if (m.ActionType == Constant.ActionType.Create)
                    {
                        m.CarouselID = item.ID;
                        carouselItemService.Add(m);
                    }
                    else if (m.ActionType == Constant.ActionType.Delete)
                    {
                        carouselItemService.Delete(m.ID);
                    }
                });
            }
            return(result);
        }
Exemple #2
0
 public override void Add(CarouselEntity item)
 {
     base.Add(item);
     if (item.CarouselItems != null)
     {
         item.CarouselItems.Each(m =>
         {
             m.CarouselID = item.ID;
             _carouselItemService.Add(m);
         });
     }
 }
 public override void Add(CarouselWidget item)
 {
     base.Add(item);
     if (item.CarouselItems != null && item.CarouselItems.Any())
     {
         item.CarouselItems.Each(m =>
         {
             m.CarouselWidgetID = item.ID;
             _carouselItemService.Add(m);
         });
     }
 }
 public override void Add(CarouselEntity item)
 {
     base.Add(item);
     if (item.CarouselItems != null)
     {
         var carouselItemService = new CarouselItemService();
         item.CarouselItems.Each(m =>
         {
             if (m.ActionType != Constant.ActionType.Unattached)
             {
                 m.CarouselID = item.ID;
                 carouselItemService.Add(m);
             }
         });
     }
 }