internal static IQueryable <vw_carrot_Content> GetContentByCategoryIDs(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, List <Guid> lstCategoryGUIDs, List <string> lstCategorySlugs)
{
if (lstCategoryGUIDs == null)
{
lstCategoryGUIDs = new List <Guid>();
}
if (lstCategorySlugs == null)
{
lstCategorySlugs = new List <string>();
}
return(from ct in ctx.vw_carrot_Contents
where ct.SiteID == siteID &&
((from m in ctx.carrot_CategoryContentMappings
join cc in ctx.carrot_ContentCategories on m.ContentCategoryID equals cc.ContentCategoryID
where cc.SiteID == siteID &&
lstCategorySlugs.Contains(cc.CategorySlug)
select m.Root_ContentID).Contains(ct.Root_ContentID) ||
(from m in ctx.carrot_CategoryContentMappings
where lstCategoryGUIDs.Contains(m.ContentCategoryID)
select m.Root_ContentID).Contains(ct.Root_ContentID)) &&
ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry) &&
(ct.PageActive == true || bActiveOnly == false) &&
(ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) &&
(ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) &&
ct.IsLatestVersion == true
select ct);
}