All the controlers are regular classes with methods.
Assuming your API controller StudentDashboard
has a Get(string name)
verb method, you can do this:
public ActionResult Index() //This view is strongly typed against User
{
//testing against Joe Bob
string adSAMName = "jBob";
var apiController = new StudentDashboardController(); //or whatever other API controller returns your data
var result = apiController.Get(adSAMName);
return View(result);
}
This should give you strong typing.
You can also instantiate and use 'regular' MVC controllers too.
[EDIT]
Per comment, it's even better if you delegate the controller creation to the framework
ControllerBuilder.GetControllerFactory().CreateController(Request.RequestContext, controllerName);
You can either set the string or extract it from the type if you want stronger typing.
Reference MSDN
All the controlers are regular classes with methods.
Assuming your API controller StudentDashboard
has a Get(string name)
verb method, you can do this:
public ActionResult Index() //This view is strongly typed against User
{
//testing against Joe Bob
string adSAMName = "jBob";
var apiController = new StudentDashboardController(); //or whatever other API controller returns your data
var result = apiController.Get(adSAMName);
return View(result);
}
This should give you strong typing.
You can also instantiate and use 'regular' MVC controllers too.
All the controlers are regular classes with methods.
Assuming your API controller StudentDashboard
has a Get(string name)
verb method, you can do this:
public ActionResult Index() //This view is strongly typed against User
{
//testing against Joe Bob
string adSAMName = "jBob";
var apiController = new StudentDashboardController(); //or whatever other API controller returns your data
var result = apiController.Get(adSAMName);
return View(result);
}
This should give you strong typing.
You can also instantiate and use 'regular' MVC controllers too.
[EDIT]
Per comment, it's even better if you delegate the controller creation to the framework
ControllerBuilder.GetControllerFactory().CreateController(Request.RequestContext, controllerName);
You can either set the string or extract it from the type if you want stronger typing.
Reference MSDN