remove method which was relocated to PageRepository
This commit is contained in:
parent
8562a68306
commit
57879c1891
|
@ -160,46 +160,6 @@ namespace Oqtane.Services
|
||||||
return site;
|
return site;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Page> GetPagesHierarchy(List<Page> pages)
|
|
||||||
{
|
|
||||||
List<Page> hierarchy = new List<Page>();
|
|
||||||
Action<List<Page>, Page> getPath = null;
|
|
||||||
getPath = (pageList, page) =>
|
|
||||||
{
|
|
||||||
IEnumerable<Page> children;
|
|
||||||
int level;
|
|
||||||
if (page == null)
|
|
||||||
{
|
|
||||||
level = -1;
|
|
||||||
children = pages.Where(item => item.ParentId == null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
level = page.Level;
|
|
||||||
children = pages.Where(item => item.ParentId == page.PageId);
|
|
||||||
}
|
|
||||||
foreach (Page child in children)
|
|
||||||
{
|
|
||||||
child.Level = level + 1;
|
|
||||||
child.HasChildren = pages.Any(item => item.ParentId == child.PageId && !item.IsDeleted && item.IsNavigation);
|
|
||||||
hierarchy.Add(child);
|
|
||||||
getPath(pageList, child);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
pages = pages.OrderBy(item => item.Order).ToList();
|
|
||||||
getPath(pages, null);
|
|
||||||
|
|
||||||
// add any non-hierarchical items to the end of the list
|
|
||||||
foreach (Page page in pages)
|
|
||||||
{
|
|
||||||
if (hierarchy.Find(item => item.PageId == page.PageId) == null)
|
|
||||||
{
|
|
||||||
hierarchy.Add(page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hierarchy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<Site> AddSiteAsync(Site site)
|
public Task<Site> AddSiteAsync(Site site)
|
||||||
{
|
{
|
||||||
if (_accessor.HttpContext.User.IsInRole(RoleNames.Host))
|
if (_accessor.HttpContext.User.IsInRole(RoleNames.Host))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user