Ejemplo n.º 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);
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 public abstract object ProcessOutgoing(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues);
Ejemplo n.º 6
0
 public abstract object ProcessOutgoing(ComplexRoute route, RouteData routeData, string key, object value, RouteValueDictionary routeValues);