/// <summary> /// Executes to the Plugin controller's action as a ChildAction but maintains the action's result so that it can be retreived /// </summary> /// <typeparam name="TResult"></typeparam> /// <typeparam name="TControllerType"></typeparam> /// <param name="controller"></param> /// <param name="proxyController"></param> /// <param name="methodSelector"></param> /// <param name="pluginDef"></param> /// <param name="backOfficePath"></param> /// <param name="routeIdParameterName">Plugin controllers routes are constructed with a route Id parameter such as editorId or surfaceId </param> /// <returns></returns> public static ProxyRequestResult <TResult> ProxyRequestToController <TResult, TControllerType>( this ControllerBase controller, TControllerType proxyController, Expression <Func <TControllerType, TResult> > methodSelector, PluginMetadataComposition pluginDef, string backOfficePath, string routeIdParameterName) where TResult : ActionResult where TControllerType : class { Mandate.ParameterNotNull(pluginDef, "pluginDef"); Mandate.ParameterNotNullOrEmpty(backOfficePath, "backOfficePath"); IDictionary <string, object> routeDictionary = new Dictionary <string, object>(); var proxyArea = backOfficePath; if (pluginDef.PluginDefinition.HasRoutablePackageArea()) { proxyArea = pluginDef.PluginDefinition.PackageName; } if (pluginDef.Id != Guid.Empty) { //need to add the routing id to it routeDictionary.Add(routeIdParameterName, pluginDef.Id.ToString("N")); } return(controller.ProxyRequestToController(proxyController, methodSelector, proxyArea, routeDictionary)); }
/// <summary> /// Executes to the Plugin controller's action as a ChildAction but maintains the action's result so that it can be retreived /// </summary> /// <param name="controller"></param> /// <param name="proxyController"></param> /// <param name="childAction"></param> /// <param name="pluginDef"></param> /// <param name="backOfficePath"></param> /// <param name="routeIdParameterName">Plugin controllers routes are constructed with a route Id parameter such as editorId or surfaceId </param> /// <param name="routeVals"></param> /// <returns></returns> public static ProxyRequestResult <ActionResult> ProxyRequestToController( this ControllerBase controller, string proxyController, string childAction, PluginMetadataComposition pluginDef, string backOfficePath, string routeIdParameterName, IEnumerable <KeyValuePair <string, object> > routeVals) { Mandate.ParameterNotNullOrEmpty(backOfficePath, "backOfficePath"); Mandate.ParameterNotNullOrEmpty(routeIdParameterName, "routeIdParameterName"); IDictionary <string, object> routeDictionary = new Dictionary <string, object>(); if (routeVals != null) { foreach (var i in routeVals) { routeDictionary.Add(i.Key, i.Value); } } var proxyArea = backOfficePath; if (pluginDef.PluginDefinition.HasRoutablePackageArea()) { proxyArea = pluginDef.PluginDefinition.PackageName; } if (pluginDef.Id != Guid.Empty) { //need to add the routing id to it routeDictionary.Add(routeIdParameterName, pluginDef.Id.ToString("N")); } return(controller.ProxyRequestToController(proxyController, childAction, routeDictionary, proxyArea)); }