Exemple #1
0
        public PageLinkModel ExtractNextLink()
        {
            if (QualifiedName.IsNullOrEmpty())
            {
                throw new ArgumentNullException("QualifiedName");
            }

            Authority sibbling = null;

            // create a default
            var result = new PageLinkModel
            {
                Text     = QualifiedName,
                Title    = QualifiedName,
                Filename = CleanQualifiedName
            };

            if (ParentAuthority != null)
            {
                var ints = ParentAuthority.Authoritys
                           .Where(h => h.HasHauntedOrgs && !h.IsCrossBorderArea)
                           .OrderBy(o => o.QualifiedName)
                           .Select(s => s.Id).ToList();

                var nextId = ints.FindNext(Id);

                if (nextId.HasValue)
                {
                    sibbling = ParentAuthority.Authoritys
                               .FirstOrDefault(x => x.Id == nextId);
                }
            }

            if (sibbling == null)
            {
                return(result);
            }

            result = new PageLinkModel
            {
                Text     = sibbling.QualifiedName,
                Title    = sibbling.QualifiedName,
                Filename = sibbling.CleanQualifiedName
            };

            return(result);
        }