Posts

Showing posts from April 16, 2019

Consume Web API in same app from MVC Controller

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box; 3 2 I'm writing an application that serves both Web API and a MVC content in .NET Core. From the MVC Controller I want to call the API's functions and receive the data that comes back. Is there a better way than using HttpClient or similar things? Like instantiating the API's controller class in the MVC Controller? I can't just go new ApiController(); since it's depending on dependency injection, can I? asp.net-core-mvc asp.net-core-webapi share | improve this question edited Nov 15 '18 at 16:15 phuzi 4,800 1 20 36 asked Nov 15 '18 at 14:54 lennyy lennyy 154 1 19 Duplicate: stackoverflow.com/questions/53322147/… – Adrian K Nov 15 '18 at 21:21 add a comment  |  3 2 I'm writing an application t