Last post Sep 16, 2014 10:17 AM by sshankaran
Sep 15, 2014 01:14 PM|sshankaran|LINK
It's an ASP.Net related question. But I don't see a corresponding forum in here. So posting my question here.
I have an MVC project and an Web Api project in a solution.
I want to to get the data to the MVC project through my Web API Services.
I know, I could use Java script to make Ajax calls to the Web API services to get the data to MVC pages.
The question is
1) I want to avoid using Java script for this purpose. I am looking to make calls to Web Api controllers from the MVC controller to get the data and give it to the views.
2) What is the best practice in this scenario and is there any drawback in making calls to Web API controller from MVC controller.
Any help is highly appreciated.
Sep 16, 2014 05:28 AM|Shawn - MSFT|LINK
Generally, we could use Java script to make Ajax calls to the Web API services to get the data to MVC pages. The WebAPI method would return Json format datas, you could use SerializeObject/DeserializeObject method it returns JSON, then you could deserialized
Json to List<>. And you could get the data from the List.
For passing data from Controller to View in ASP.NET MVC:
For detailed information:
Sep 16, 2014 10:17 AM|sshankaran|LINK
Thanks for your reply and for the links.
What is the best practice for this.