public SectionVM GetBy(string urlName, int?id) { var section = urlName.IsEmpty() ? SectionService.GetByPK(id) : SectionService.GetAll().ByUrlName(urlName); if (section == null) { return(null); } var sectionIdsContainUserWorks = GetSectionIdsContainUserWorks(); var entityWithTags = EntityCommonService.GetEntityWithTags(section); AddMicrosoft(section, entityWithTags); var parent = SectionService.GetSectionsTree() .FirstOrDefault(z => z.SubSections .Any(x => x.Section_ID == section.Section_ID)); return (new SectionVM { Section = section, Parent = parent, EntityWithTags = entityWithTags, SectionIdContainUserWorks = sectionIdsContainUserWorks, }); }
GetSectionWithEntityTree() { var mainSections = SectionService.GetAll(x => x.IsMain && x.IsActive) .OrderBy(x => x.WebSortOrder).ToList(); return(mainSections.Select(x => EntityWithList.New((IEntityCommonInfo)x, SiteObjectRelationService.GetMenuTree(x).Select(e => e.Entity) .Where(e => e is Section || e.As <IForMainPage>() .GetOrDefault(z => z.ForMainPage)))).ToList()); }