Here Mudassar Ahmed Khan has explained with an example, how to call (consume) Web API inside HTTP POST Action method of Controller in ASP.Net MVC Razor.
When the Submit Button is clicked, the HTTP POST Action method of Controller will be called which in turn will call the Controller method of Web API 2.
The Web API 2 Controller method will fetch records from database using Entity Framework in ASP.Net MVC Razor.
The Web API 2 Controller method will be called using WebClient class inside MVC Controller.
↧