private CarouselViewModel GetCarouselViewModel(IPageHeroCarouselComposition content) { if (ExistenceUtility.IsNullOrEmpty(content.HeroImages)) { return(null); } var viewModel = new CarouselViewModel(); viewModel.Headline = content.Headline; viewModel.Text = content.HeroContent; List <ImageViewModel> images = new List <ImageViewModel>(); foreach (var image in content.HeroImages) { ImageViewModel imageModel = new ImageViewModel() { Url = image.Url, TitleText = image.GetPropertyValue <string>("titleText"), }; images.Add(imageModel); } viewModel.Images = images; return(viewModel); }
/// <summary>Static getter for Hero Content</summary> public static IHtmlString GetHeroContent(IPageHeroCarouselComposition that) { return(that.GetPropertyValue <IHtmlString>("heroContent")); }
/// <summary>Static getter for Headline</summary> public static string GetHeadline(IPageHeroCarouselComposition that) { return(that.GetPropertyValue <string>("headline")); }
/// <summary>Static getter for Hero Images</summary> public static IEnumerable <IPublishedContent> GetHeroImages(IPageHeroCarouselComposition that) { return(that.GetPropertyValue <IEnumerable <IPublishedContent> >("heroImages")); }