I create a controller of scheduled tasks - these tasks will call the Controller and Action , fixing the result. I would prefer it all to happen on the backend and not include http calls.
This is similar to what happens with unit testing - for example:
var controller = new TestController(); var result = controller.Index("TestParameter") as ViewResult;
The problem in this example: the controller and the action are not dynamic, does anyone know how to initialize the controller and call the action with the controller name and action as a string parameter? For example:
public ActionResult run(string controllerName, string actionName) { var controller = new Controller(controllerName); var result = controller.action(actionName).("TestParameter") as ViewResult; return Content(result); }
c # asp.net-mvc asp.net-mvc-4
Harleyz
source share