Query 2 Types into one.

Brian Brown asked on February 22, 2022 23:09

This might be more of a c# question than Kentico related.

I'm getting a list of 2 different Event Types but would like them in one list and sort by EventDate which both share.

    var EventsFree = EventDetailFreeProvider.GetEventDetailFrees()
        .Culture(CurrentDocument.DocumentCulture)
        .OrderBy("EventStart ASC")
        .Published()
        .ToList();

    var EventsPaid = EventDetailPaidProvider.GetEventDetailPaids()
        .Culture(CurrentDocument.DocumentCulture)
        .OrderBy("EventStart ASC")
        .Published()
        .ToList(); 

Can I combine these 2 statements into 1?

Recent Answers


Brian Brown answered on February 23, 2022 17:50

I went a different route to get this to work.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on February 24, 2022 08:59

Hi Brian,

You can use MultiDocumentQuery for this purpose. Please refer to the documentation page.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.