public Page GetPreviousPage() { if (TotalPages == 0) { return(null); } if (_currentPage > TotalPages || _currentPage <= 1) { _currentPage = Pages.Last().PageNumber; return(ActivePages.Last()); } _currentPage--; return(ActivePages[_currentPage - 1]); }
public Page GetNextPage() { if (TotalPages == 0) { return(null); } if (_currentPage >= TotalPages || _currentPage <= 0) { _currentPage = Pages.First().PageNumber; return(ActivePages.First()); } _currentPage++; return(ActivePages[_currentPage - 1]); }
private int GetNextPageIndex(int currentIndex) { if (currentIndex == ActivePages.Max(x => x.Key)) { return(currentIndex); } var newIndex = currentIndex + 1; if (Pages[newIndex].PageConfig.IsHidden) { return(GetNextPageIndex(newIndex)); } return(newIndex); }
private string GetNestedName() { IEnumerable <Webpage> categories = ActivePages.TakeWhile(webpage => webpage.Unproxy() is Category).Reverse(); return(string.Join(" > ", categories.Select(webpage => webpage.Name))); }