public override int Delete(params object[] primaryKeys) { var group = Get(primaryKeys); var contentService = new SectionContentService(); var contents = contentService.Get(new DataFilter().Where("SectionGroupId", OperatorType.Equal, group.ID)); contents.Each(m => { contentService.Delete(m.ID); }); return(base.Delete(primaryKeys)); }
private SectionWidget InitSectionWidget(SectionWidget widget) { widget.Groups = new SectionGroupService().Get("SectionWidgetId", OperatorType.Equal, widget.ID); var sectionContentService = new SectionContentService(); var contents = sectionContentService.Get("SectionWidgetId", OperatorType.Equal, widget.ID).ToList(); for (int i = 0; i < contents.Count; i++) { contents[i] = sectionContentService.FillContent(contents[i]); } widget.Groups.Each(m => { m.SectionContents = contents.Where(n => n.SectionGroupId == m.ID); }); return(widget); }