예제 #1
0
        public virtual ActionResult GetActionResult()
        {
            var controllerContext = _actionExecutionContext.ControllerContext;
            var actionDescriptor  = _actionExecutionContext.ActionDescriptor;

            var parameters            = _parameters ?? GetParameterValues(controllerContext, actionDescriptor);
            var actionExecutedContext = InvokeActionMethodWithFilters(controllerContext, _filterInfo.ActionFilters,
                                                                      actionDescriptor, parameters);

            if (actionExecutedContext == null)
            {
                throw new Exception("GetActionResult returned null");
            }

            SimulatorHelper.InitizializeActionResults(actionExecutedContext.Result, _mvcApplication.Routes);
            return(actionExecutedContext.Result);
        }
예제 #2
0
        protected override AuthorizationContext InvokeAuthorizationFilters(ControllerContext controllerContext, IList <IAuthorizationFilter> filters,
                                                                           ActionDescriptor actionDescriptor)
        {
            var context = new AuthorizationContext(controllerContext, actionDescriptor);

            foreach (var filter in filters)
            {
                filter.OnAuthorization(context);
                // short-circuit evaluation when an error occurs
                if (context.Result == null)
                {
                    continue;
                }

                SimulatorHelper.InitizializeActionResults(context.Result, _mvcApplication.Routes);
                break;
            }

            return(context);
        }