public async Task <ActionResult> Index()
        {
            _seen.Clear();
            _seenChild.Clear();
            _entries.Clear();

            var url = new Url(Request.Url).RemoveTrailingSegment().RemoveExtension();

            if (WebSession.Current.SiteId != null)
            {
                // add categories for this site
                var categories = await _catViewModelBuilder.GetCategoriesAsync(null, levels : 99).ConfigureAwait(false);

                AddCategoriesRecursive(categories);
            }
            AddContentPages(url);

            // sort sitemap by URL
            _entries.Sort(Comparer <SiteMapEntry> .Create((a, b) => string.Compare(a.Url, b.Url, StringComparison.Ordinal)));

            return(new SiteMapXmlResult(_entries));
        }
Beispiel #2
0
        public async Task <ActionResult> Index(string id, string categoryId)
        {
            long?catId;

            try
            {
                catId = long.Parse(categoryId);
            }
            catch
            {
                catId = null;
            }

            var categories = await _catViewModelBuilder.GetCategoriesAsync(catId, levels : 99).ConfigureAwait(false);

            var viewModel = new CategoryPickerViewModel
            {
                SearchCriteria = "",
                Categories     = categories,
                ControlId      = id
            };

            return(View(viewModel));
        }