Пример #1
0
        protected override IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext)
        {
            var umbracoHelper = new UmbracoHelper(umbracoContext);
            var rootNode      = (IPublishedContent)umbracoHelper.ContentAtXPath("//airportRepository").FirstOrDefault();
            var basisNode     = rootNode?.Children().FirstOrDefault(x => x.DocumentTypeAlias == "airportInformation");
            var detailNode    = rootNode?.Children.FirstOrDefault(x =>
                                                                  PublishedContentExtensions.GetPropertyValue <string>(x, "iCAOCode").ToLower() == requestContext.RouteData.Values["id"].ToString().ToLower());

            if (detailNode != null)
            {
                return(detailNode);
            }
            return(basisNode);
        }
Пример #2
0
 private List<ContentItemBasic> GetSettingsByXPath(string xPath)
 {
     var uHelper = new UmbracoHelper(UmbracoContext.Current);
     var ids = ((IEnumerable<IPublishedContent>)uHelper.ContentAtXPath(xPath)).Select(x => x.Id);
     var content = ApplicationContext.Current.Services.ContentService
         .GetByIds(ids)
         .OrderBy(x => x.Name)
         .Select(Mapper.Map<IContent, ContentItemBasic<ContentPropertyBasic, IContent>>).ToList<ContentItemBasic>();
     return content;
 }