Example #1
0
        public static Guid GetHomePageIDBySiteID(string siteid)
        {
            Guid    returnValue;
            CmsPage homePage;
            BaseCollection <CmsPage> pagesInFolder = BaseCollection <CmsPage> .Get("FK_Folder IS NULL AND FK_Site = '" + siteid + "'", "Name");

            homePage = pagesInFolder.Where(c => c.IsHomePage).FirstOrDefault();

            if (homePage == null)
            {
                homePage = pagesInFolder.Where(c => c.Name.ToLower() == "default").FirstOrDefault();
            }

            if (homePage == null)
            {
                homePage = pagesInFolder.Where(c => c.Name.ToLower() == "index").FirstOrDefault();
            }

            if (homePage == null)
            {
                homePage = pagesInFolder.FirstOrDefault();
            }

            if (homePage != null)
            {
                returnValue = homePage.ID;
            }
            else
            {
                returnValue = Guid.Empty;
            }
            return(returnValue);
        }