コード例 #1
0
        public override IDictionary <string, object> Serialize(IGridUrlBuilder urlBuilder)
        {
            var state = base.Serialize(urlBuilder);

            if (Text.HasValue())
            {
                state["text"] = Text;
            }

            if (SendState && !Ajax)
            {
                RouteValues.AddRange(urlBuilder.GetState());
            }

            var dataRouteValues = DataRouteValues.Cast <IGridDataKey>();

            if (Ajax)
            {
                state["ajax"] = true;
            }

            if (SendDataKeys)
            {
                dataRouteValues = dataRouteValues.Concat(urlBuilder.GetDataKeys());
            }

            foreach (var route in dataRouteValues)
            {
                RouteValues[route.RouteKey] = "<#=" + route.Name + "#>";
            }

            state["url"] = urlBuilder.Url(this);

            return(state);
        }
コード例 #2
0
        private RouteValues Read(Type controllerType, MethodCallExpression methodCall)
        {
            var values = new RouteValues();

            values.Controller = ControllerName(controllerType);
            values.Action     = ActionName(methodCall);
            values.Area       = AreaName(controllerType);

            values.AddRange(ReadParameters(methodCall));

            return(values);
        }
コード例 #3
0
ファイル: Generator.cs プロジェクト: sanderd/MvcRouteTester
        public RouteValues ReadRequestProperties(string url, HttpMethod httpMethod, BodyFormat bodyFormat)
        {
            if (!CheckValid(url, httpMethod))
            {
                return(new RouteValues());
            }

            var actualProps = new RouteValues();

            actualProps.Controller = ControllerName();
            actualProps.Action     = ActionName();

            actualProps.AddRange(GetRouteParams());

            var queryParams = UrlHelpers.ReadQueryParams(url);

            actualProps.AddRange(queryParams);
            actualProps.AddRange(ReadPropertiesFromBodyContent(bodyFormat));

            actualProps.Sort();

            return(actualProps);
        }