As soon as I asked this question, I realised I could just append my query with this:
.List().Select(p=>p.ContentItem)
Sometimes it just helps to talk your problem through!
Question
I'm using Orchard 1.7.2.
I have created a new content type called PropertyImage
of stereotype Media. I also created a part called PropertyPart
and attached that part to my PropertyImage
content type. This allows a user to pick a product when uploading a PropertyImage
(ie to say 'This image is of this property').
So far so good.
Now what I'd like to do is query for all PropertyImage
s that have a PropertyPart
attached to them where the associated property is x
, y
, or z
.
This is what I have so far:
var images = _orchardServices.ContentManager
.Query<PropertyPart, PropertyRecord>()
.Where(p => p.PropertyId == id)
.ForType(new[] { "PropertyImage" });
This however will only return a collection of PropertyPart
s, which is not what I want, because I want the whole PropertyImage
Content Item. How can I do this?
I should point out that properties come from an external source, and are therefore not content items.
Edit
As soon as I asked this question, I realised I could just append my query with this:
.List().Select(p=>p.ContentItem)
Sometimes it just helps to talk your problem through!
La solution
As soon as I asked this question, I realised I could just append my query with this:
.List().Select(p=>p.ContentItem)
Sometimes it just helps to talk your problem through!