I am building a scheduled jobs controller - these jobs will call a Controller and an Action capturing the result. I would rather have all this happen on the backend and not involve http calls.
Its kind of like what happens with Unit testing - for instance:
var controller = new TestController();
var result = controller.Index("TestParameter") as ViewResult;
The issue is in this example the controller and action are not dynamic, does anyone know how to initialize a controller and call an action with the name of the controller and action as string paramater? Such as -
public ActionResult run(string controllerName, string actionName)
{
var controller = new Controller(controllerName);
var result = controller.action(actionName).("TestParameter") as ViewResult;
return Content(result);
}