Beispiel #1
0
        public static void Execute(ControllerActionRequest actionRequest, Action <ControllerContext> contextCallback, Action <ResponseStatus> statusCallback)
        {
            Guard.ArgumentNotNull(actionRequest, "actionRequest");

            Resolve(actionRequest, (r) =>
            {
                if (contextCallback != null)
                {
                    contextCallback(r);
                }
                if (statusCallback != null)
                {
                    statusCallback(r.Status);
                }
                if (r.Controller != null)
                {
                    r.Controller.Execute(r);
                }
                else if (r.Status != ResponseStatus.Success && r.Status != ResponseStatus.Cancelled)
                {
                    throw new ControllerActionException(string.Format(ACTION_COULDNOT_EXECUTE, actionRequest.RequestUrl),
                                                        r.Status, actionRequest, r.Error);
                }
            });
        }
Beispiel #2
0
        public static void Resolve(ControllerActionRequest actionRequest, Action <ControllerContext> responseCallback)
        {
            Guard.ArgumentNotNull(actionRequest, "request");
            Guard.ArgumentNotNull(responseCallback, "responseCallback");

            // NOTE_: if the response is a action context response, we send that else we wrap it in a action
            // context response this is done because the api expects this..
            RoutingService.Resolve(actionRequest, (r) =>
            {
                if (typeof(ControllerContext).IsAssignableFrom(r.GetType()))
                {
                    responseCallback((ControllerContext)r);
                }
                else
                {
                    responseCallback(new ControllerContext(r));
                }
            });
        }
 public ControllerActionException(string message, ResponseStatus status, ControllerActionRequest request, Exception innerException)
     : base(message, innerException)
 {
     _status  = status;
     _request = request;
 }
 public ControllerActionException(string message, ResponseStatus status, ControllerActionRequest request)
     : this(message, status, request, null)
 {
 }
 public ControllerContext(ControllerActionRequest request, ResponseStatus responseStatus, IController controller,
                          ParametersCollection responseParameters)
     : base(request, responseStatus, controller, responseParameters)
 {
 }
Beispiel #6
0
 public static void Execute(ControllerActionRequest actionRequest, Action <ControllerContext> contextCallback)
 {
     Execute(actionRequest, contextCallback, null);
 }
Beispiel #7
0
 public static void Execute(ControllerActionRequest actionRequest, Action <ResponseStatus> statusCallback)
 {
     Execute(actionRequest, null, statusCallback);
 }
Beispiel #8
0
 public static void Execute(ControllerActionRequest actionRequest)
 {
     Execute(actionRequest, null, null);
 }