New Rotator query
Hi,
I have created a Dynamic Module that I am using to display ads. I have adapted your NewsRotator example to fit my scenerio. Everything seems to work fine until I run the query to join my dynamic content and the image.
Below is the query used for the NewsRotator example:
var dataSource = App.WorkWith().NewsItems().Publihed()
.Get().Take(this.NewsLimit)
.ToList()
.Join(
App.WorkWith().Images().Publihed()
.Get()
.Where(i => i.Parent.Title == "Thumbnails"),
item => item.Title.Value,
image => image.Title.Value,
(item, image) => new NewsItem = item, NewsImage = image
);
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type businessPremiumListingType = TypeResolutionService.ResolveType(PremiumListingContentType);
var imagesQuery = App.WorkWith().Images().Publihed()
.Get()
.Where(i => i.Parent.Title == "Thumbnails");
var datasource = dynamicModuleManager.GetDataItems(businessPremiumListingType)
.Where(i => i.Status == ContentLifecycleStatus.Live && i.Visible == true)
.Take(this.BusinessLimit);
var ds = datasource.Join(imagesQuery,
item => item.GetValue<
Guid
>("ad"),
image => image.Id,
(item, image) => new BusinessItem = item, BusinessImage = image );