Ejemplo n.º 1
0
        private ActionResult GetRedirectOnFinish()
        {
            var redirectTo = ControllerContext.HttpContext.Request["redirectTo"];

            if (!string.IsNullOrEmpty(redirectTo))
            {
                return(Redirect(redirectTo));
            }

            var defaultRedirect = RunningObjectsSetup.Configuration.DefaultRedirect;

            if (defaultRedirect != null)
            {
                var routeValues = defaultRedirect.Action != RunningObjectsAction.Welcome
                                      ? LinkExtensions.CreateRouteValueDictionary(defaultRedirect.Type, defaultRedirect.Arguments)
                                      : null;

                return(RedirectToAction(defaultRedirect.Action.ToString(), "Presentation", routeValues));
            }
            return(RedirectToAction(RunningObjectsAction.Welcome.ToString(), "Presentation"));
        }
Ejemplo n.º 2
0
        private Func <object, ActionResult> OnSuccess(Type modelType)
        {
            return(instance =>
            {
                var redirectTo = ControllerContext.HttpContext.Request["redirectTo"];
                if (!string.IsNullOrEmpty(redirectTo))
                {
                    return Redirect(redirectTo);
                }

                var defaultRedirect = RunningObjectsSetup.Configuration.DefaultRedirect;
                if (defaultRedirect != null)
                {
                    var routeValues = defaultRedirect.Action != RunningObjectsAction.Welcome
                        ? LinkExtensions.CreateRouteValueDictionary(defaultRedirect.Type, defaultRedirect.Arguments)
                        : null;

                    return RedirectToAction(defaultRedirect.Action.ToString(), "Presentation", routeValues);
                }
                return RedirectToAction("Index", new { modelType = modelType.PartialName() });
            });
        }
Ejemplo n.º 3
0
        private Func <object, ActionResult> OnSuccessWithReturn(Method model)
        {
            return(@return =>
            {
                var result = ParseResult(model, @return);
                if (result is ModelCollection)
                {
                    return View("Index", result);
                }

                if (result is Redirect)
                {
                    var redirect = result as Redirect;
                    return RedirectToAction(redirect.Action.ToString(), "Presentation", LinkExtensions.CreateRouteValueDictionary(redirect.Type, redirect.Arguments));
                }

                var redirectTo = ControllerContext.HttpContext.Request["redirectTo"];
                if (!string.IsNullOrEmpty(redirectTo))
                {
                    return Redirect(redirectTo);
                }
                return null;
            });
        }