Пример #1
0
        private List <ParallaxItem> SetParallaxItems(IQueryable <DynamicContent> items)
        {
            List <ParallaxItem> parallaxItems = new List <ParallaxItem>();

            foreach (var item in items)
            {
                ParallaxItem parallaxItem = new ParallaxItem();
                parallaxItem.Title   = item.GetValue <Lstring>("Title");
                parallaxItem.Details = item.GetValue <Lstring>("Details");
                IDataItem pageSelectorItem = item.GetRelatedItems("Url").FirstOrDefault();
                parallaxItem.ItemUrl = pageSelectorItem.GetDefaultUrl();
                //getting the image
                Image imageField = item.GetRelatedItems <Image>("Photo").SingleOrDefault();
                //getting the url
                parallaxItem.ImageUrl = imageField.Url;
                parallaxItem.ImageAlt = imageField.AlternativeText;
                parallaxItems.Add(parallaxItem);
            }

            return(parallaxItems);
        }