Carrotware.CMS.Core.CannedQueries.GetAllContentList C# (CSharp) Method

GetAllContentList() static private method

static private GetAllContentList ( CarrotCMSDataContext ctx, Guid siteID ) : IQueryable
ctx CarrotCMSDataContext
siteID Guid
return IQueryable
        internal static IQueryable<vw_carrot_Content> GetAllContentList(CarrotCMSDataContext ctx, Guid siteID)
        {
            return (from ct in ctx.vw_carrot_Contents
                    orderby ct.NavOrder, ct.NavMenuText
                    where ct.SiteID == siteID
                     && ct.IsLatestVersion == true
                     && ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry)
                    select ct);
        }

Usage Example

Ejemplo n.º 1
0
        public void FixOrphanPages(Guid siteID)
        {
            List <SiteMapOrder> lstContent = CannedQueries.GetAllContentList(db, siteID).Select(ct => new SiteMapOrder(ct)).ToList();
            List <Guid>         lstIDs     = lstContent.Select(x => x.Root_ContentID).ToList();

            lstContent.RemoveAll(x => x.Parent_ContentID == null);
            lstContent.RemoveAll(x => lstIDs.Contains(x.Parent_ContentID.Value));

            lstIDs = lstContent.Select(x => x.Root_ContentID).ToList();

            IQueryable <carrot_Content> querySite = (from c in db.carrot_Contents
                                                     where c.IsLatestVersion == true &&
                                                     c.Parent_ContentID != null &&
                                                     lstIDs.Contains(c.Root_ContentID)
                                                     select c);

            db.carrot_Contents.BatchUpdate(querySite, p => new carrot_Content {
                Parent_ContentID = null
            });

            IQueryable <carrot_Content> querySite2 = (from c in db.carrot_Contents
                                                      join rc in db.carrot_RootContents on c.Root_ContentID equals rc.Root_ContentID
                                                      where c.IsLatestVersion == true &&
                                                      c.Parent_ContentID != null &&
                                                      rc.SiteID == siteID &&
                                                      rc.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry)
                                                      select c);

            db.carrot_Contents.BatchUpdate(querySite2, p => new carrot_Content {
                Parent_ContentID = null
            });

            db.SubmitChanges();
        }
All Usage Examples Of Carrotware.CMS.Core.CannedQueries::GetAllContentList