public static void AddBasicRouteInputs(ActionCall call, RouteDefinition route)
        {
            call.InputType()
                .GetProperties()
                .Where(x => x.HasAttribute<RouteInputAttribute>())
                .Each(prop => route.Append("{" + prop.Name + "}"));

            route.ApplyInputType(call.InputType());
        }
        public IRouteDefinition Build(ActionCall call)
        {
            string pattern = call.HandlerType.GetGenericArguments()[0].Name.Replace("ViewModel", "");

            var route = new RouteDefinition(pattern.ToLower());
            route.Append("{Id}");

            if (call.InputType().Name.StartsWith("Edit`"))
            {
                route.Append("edit");
            }
            else if (call.InputType().Name.StartsWith("Get`"))
            {
                route.Append("view");
            }

            route.ApplyInputType(call.InputType());
            route.AddHttpMethodConstraint("GET");

            return route;
        }
Beispiel #3
0
        public void AddRouteInput(RouteParameter parameter, bool appendToUrl)
        {
            if (_routeParameters.Any(x => x.Name == parameter.Name))
            {
                return;
            }

            if (appendToUrl)
            {
                _parent.Append("{" + parameter.Name + "}");
            }

            _routeParameters.Add(parameter);
        }
Beispiel #4
0
        public void AddRouteInput(RouteParameter parameter, bool appendToUrl)
        {
            if (_routeParameters.Any(x => x.Name == parameter.Name))
            {
                return;
            }

            if (appendToUrl)
            {
                _parent.Append("{" + parameter.Name + "}");
            }

            if (Parent != null)
            {
                Parent.Trace("Added '{0}' to route parameters", parameter);
            }

            _routeParameters.Add(parameter);
        }