Carrotware.CMS.Core.ContentPageType.GetIDByType C# (CSharp) Method

GetIDByType() public static method

public static GetIDByType ( PageType contentType ) : System.Guid
contentType PageType
return System.Guid
        public static Guid GetIDByType(PageType contentType)
        {
            ContentPageType _type = ContentPageTypeList.Where(t => t.ContentTypeValue.ToLowerInvariant() == contentType.ToString().ToLowerInvariant()).FirstOrDefault();

            return _type.ContentTypeID;
        }

Usage Example

        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);
        }
All Usage Examples Of Carrotware.CMS.Core.ContentPageType::GetIDByType