示例#1
0
        public OutputViewModel PrepareLocalityModel(
            IEnumerable <KeyValuePair <string, PageLinkModel> > orgLocalityLinks, string locality,
            Authority authority)
        {
            if (orgLocalityLinks == null)
            {
                throw new ArgumentNullException("orgLocalityLinks");
            }
            if (locality == null)
            {
                throw new ArgumentNullException("locality");
            }
            if (authority == null)
            {
                throw new ArgumentNullException("authority");
            }

            var collection = new PageLinkKeyedCollection(orgLocalityLinks, locality);

            if (collection.NextSibling.Key == null)
            {
                return(null);
            }

            var next = new PageLinkModel
            {
                Text     = collection.NextSibling.Key,
                Title    = collection.NextSibling.Key,
                Filename = collection.NextSibling.Key.In(authority.CleanQualifiedName, true),
            };

            var model = OutputViewModel.CreateLocalityOutputViewModel(locality, authority,
                                                                      collection.Links, next, "{0}, {1}, {2}");

            return(model);
        }