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; }
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; }
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; }
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); }
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; }