public static IEnumerable <CMSPage> GetByType(string typeName) { var type = new DB().PageTypes.FirstOrDefault(x => x.TypeName == typeName); return(type == null ? new List <CMSPage>() { new CMSPage() { FullUrl = "/" } } : FullPageTable.Where(x => x.Type == type.ID).ToList()); }
private void FillChildren(CMSPage cmsPage) { var childs = FullPageTable.Where(x => x.ParentID == cmsPage.ID).ToList(); if (childs.Any()) { _fullChildrenList.AddRange(childs.Select(x => x.ID)); } foreach (var child in childs) { FillChildren(child); } }
private void FillChildrenList(CMSPage cmsPage, ref List <int> list, int count) { var childs = FullPageTable.Where(x => x.ParentID == cmsPage.ID).ToList(); if (childs.Any()) { list.AddRange(childs.Select(x => x.ID)); } if (list.Count >= count) { return; } foreach (var child in childs) { FillChildrenList(child, ref list, count); } }
public IEnumerable <CMSPage> GetHalfOfChildren(bool left, int limit = 100) { var all = FullPageTable.Where(x => x.ParentID == ID).Take(limit).ToList(); int leftCount = 0; int rem = 0; leftCount = Math.DivRem(all.Count(), 2, out rem); if (rem > 0) { leftCount++; } if (left) { return(all.Take(leftCount)); } return(all.Skip(leftCount)); }
public static IEnumerable <CMSPage> GetByType(int typeId) { return(FullPageTable.Where(x => x.Type == typeId).ToList()); }
public IEnumerable <CMSPage> GetChildren() { return(FullPageTable.Where(x => x.ParentID == ID).ToList()); }