Beispiel #1
0
        public IRouteResult Process(IRoute route)
        {
            var showAs = route.Parameters[KnownParameters.ParentShowAs].ToString();
            var view = route.Parameters[KnownParameters.ParentView];

            var next = new Route("close", showAs);
            next.AddParameter(KnownParameters.View, view);

            var result = new RouteResult(route);
            result.Next(next);

            return result;
        }
Beispiel #2
0
        public IRouteResult Process(IRoute route)
        {
            var result = new RouteResult(route);

            var next = new Route("show", "errors")
                .CopyParameterFrom(route, KnownParameters.Errors);

            var view = route.Parameters[KnownParameters.ParentView];
            next.AddParameter(KnownParameters.View, view);

            result.Next(next);

            return result;
        }
Beispiel #3
0
        public IRouteResult Execute(IRoute route)
        {
            var method = GetMethod(route);

            var parameters = GetParameters(route, method);

            object result = method.Invoke(this, parameters);

            var next = CreateRoute(result);

            if (next == null)
                return new EndRouteResult(route);

            var routeResult = new RouteResult(route);
            routeResult.Next(next);
            return routeResult;
        }
Beispiel #4
0
        IRouteResult CreateRoute(object returnObject, IRoute route)
        {
            if (returnObject == null)
                return new EndRouteResult(route); ;

            if (returnObject.GetType().CanBeCastTo<IRoute>())
            {
                var next = returnObject as IRoute;
                var routeResult = new RouteResult(route);
                routeResult.Next(next);
                return routeResult;
            }

            if (returnObject.GetType() == typeof (string))
            {
                var next = returnObject.ToString().ToRoute();
                var routeResult = new RouteResult(route);
                routeResult.Next(next);
                return routeResult;
            }

            return new ViewModelRouteResult(route, returnObject);
        }
Beispiel #5
0
        public static IRouteResult NoMappedFunc(IRoute route)
        {
            var result = new RouteResult
                             {
                                 Success = false,
                                 Message = "No function mapped for route {0}".FormatWith(route)
                             };
            result.AddHistory(route);

            return result;
        }