Esempio n. 1
0
        private static void AddRouteData(PortalRequest request, PortalResponse response, Route route)
        {
            if (route == null)
            {
                return;
            }

            request.MergeTokens(route.GetTokens(request.Path));
            NameValueCollection queryString = request.QueryString;

            if (queryString.Count > 0)
            {
                RouteTokens queryTokens = new RouteTokens();
                foreach (string s in queryString)
                {
                    queryTokens.Add(s, queryString[s]);
                }
                request.MergeTokens(queryTokens);
            }

            request.ControllerName = route.ControllerName ?? request.GetTokenValue(ControllerNameToken);

            foreach (TileDefinition tile in route.Tiles)
            {
                response.Tiles.Add(tile);
            }

            if (!Compare.IsNullOrEmpty(route.PageTitle))
            {
                request.Title = FormattableObject.ToString(request.Tokens.ToDictonary(), route.PageTitle, null);
            }
        }
Esempio n. 2
0
        private static void AddControllerResult(PortalContext context, PortalRequest request, SectionData section)
        {
            ControllerMetaWrapper controller = section.GetControllerMeta(request.ControllerName);
            string actionName = controller.Name == "Home" ? request.GetTokenValue(ControllerNameToken) : request.GetTokenValue(ControllerActionToken);

            if (actionName == null || actionName == controller.Name)
            {
                actionName = "Index";
            }

            request.ControllerName = controller.Name;
            request.ActionName     = actionName;
            request.Result         = controller.Execute(context);
        }