Example #1
0
        public override object ProcessOutgoing(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues)
        {
            var id = value as int?;

            if (id == null)
            {
                return(null);
            }

            var dependency = Dependency == null ? null : routeValues[Dependency];

            // use current value if new value is not explicitly defined and route will use the old one
            // todo: verify whether still necessary
            if (dependency == null && route.Url.Contains("{" + Dependency + "}"))
            {
                dependency = routeData.Values[Dependency];
            }

            var token = Tokens.Translate(id.Value, dependency == null ? null : dependency.ToString());

            if (token == null)
            {
                return(null);
            }

            return(token);
        }
        public override object ProcessIncoming(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues)
        {
            var token = value as string;
            if (token == null)
                return null;

            var dependency = Dependency == null ? null : routeValues[Dependency];

            var id = Tokens.Translate(token, dependency == null ? null : dependency.ToString());
            if (!id.HasValue)
                return null;

            return id.Value;
        }
        public override object ProcessOutgoing(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues)
        {
            var id = value as int?;
            if (id == null)
                return null;

            var dependency = Dependency == null ? null : routeValues[Dependency];

            // use current value if new value is not explicitly defined and route will use the old one
            // todo: verify whether still necessary
            if (dependency == null && route.Url.Contains("{" + Dependency + "}"))
                dependency = routeData.Values[Dependency];

            var token = Tokens.Translate(id.Value, dependency == null ? null : dependency.ToString());
            if (token == null)
                return null;

            return token;
        }
Example #4
0
        public override object ProcessIncoming(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues)
        {
            var token = value as string;

            if (token == null)
            {
                return(null);
            }

            var dependency = Dependency == null ? null : routeValues[Dependency];

            var id = Tokens.Translate(token, dependency == null ? null : dependency.ToString());

            if (!id.HasValue)
            {
                return(null);
            }

            return(id.Value);
        }
Example #5
0
 public abstract object ProcessOutgoing(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues);
Example #6
0
 public abstract object ProcessOutgoing(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues);