I'm using ASP.NET Core MVC and Web API and trying to consume the internal Web API (done using ApiController, prepare for future cross-platform application use), I saw an answer which doesn't need to use HttpClient or any Http Request features to get data from Web API, refer: Consuming web api controller action from mvc controller
I'm trying to do the similar thing, but my auto generated Web API Controller comes with DBContext parameter, which causing me unable to follow what is mentioned from the link.
Below is what i have in my Controller which caused me unable to follow actions mentioned in the link above:
private readonly MyTestDBContext _context;
public MfgProductsController(MyTestDBContext context)
{
_context = context;
}
If the "MyTestDBContext context" parameter supposed to remain, what should I write in my Controller in order to pass the DBContext in?
Or if there's a way to remove "MyTestDBContext context" from the parameter, how the constructor supposed to change to?