Пример #1
0
        /// <summary>
        /// Create the member profile route - It's a fake page
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="nodeRoutePath"></param>
        /// <param name="nodesWithPath"></param>
        private static void MapMemberRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
 
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>(AppConstants.PropMemberUrlName)))
            {
                if (string.IsNullOrWhiteSpace(nodeSearch.Key))
                    continue;
                    
                var routeHash = nodeSearch.Key.GetHashCode();

                //Create the route for the /search/{term} results
                routes.MapUmbracoRoute(
                    string.Format(MemberRouteName, routeHash),
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{membername}").TrimStart('/'),
                    new
                    {
                        controller = "DialogueMember",
                        action = "Show",
                        topicname = UrlParameter.Optional
                    },
                    new DialogueMemberRouteHandler(nodesWithPath));
            }

        }
Пример #2
0
        private static void MapSearchRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            //we need to group by the search url name and make unique routes amongst those,
            // alternatively we could create route constraints like we do for the tags/categories routes
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>("searchUrlName")))
            {
                //the hash needs to be the combination of the nodeRoutePath and the searchUrl group
                var routeHash = (nodeRoutePath + nodeSearch.Key).GetHashCode();

                //Create the route for the /search/{term} results
                routes.MapUmbracoRoute(
                    "articulate_search_" + routeHash,
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{term}").TrimStart('/'),
                    new
                    {
                        controller = "ArticulateSearch",
                        action = "Search",
                        term = UrlParameter.Optional
                    },
                    new ArticulateSearchRouteHandler(nodesWithPath));
            }
        }