public override void UpdateWidget(WidgetBase widget) { base.UpdateWidget(widget); var item = widget as CarouselWidget; if (item.CarouselItems != null && item.CarouselItems.Any()) { _carouselItemService.BeginBulkSave(); item.CarouselItems.Each(m => { m.CarouselWidgetID = item.ID; if (m.ActionType == ActionType.Create) { _carouselItemService.Add(m); } else if (m.ActionType == ActionType.Delete) { _carouselItemService.Remove(m); } else { _carouselItemService.Update(m); } }); _carouselItemService.SaveChanges(); } }
private void SaveCarouselItems(CarouselItemEntity item) { switch (item.ActionType) { case ActionType.Create: { _carouselItemService.Add(item); break; } case ActionType.Update: { _carouselItemService.Update(item); break; } case ActionType.Delete: { if (item.ID > 0) { _carouselItemService.Remove(item); } break; } } }
public override bool Update(CarouselWidget item, params object[] primaryKeys) { if (item.CarouselItems != null && item.CarouselItems.Any()) { item.CarouselItems.Each(m => { m.CarouselWidgetID = item.ID; _carouselItemService.Update(m); }); } return(base.Update(item, primaryKeys)); }
public override bool Update(CarouselEntity item, params object[] primaryKeys) { bool result = base.Update(item, primaryKeys); if (item.CarouselItems != null) { item.CarouselItems.Each(m => { m.CarouselID = item.ID; _carouselItemService.Update(m); }); } return(result); }