Using MVC app with WebApi

Hi guys did you recomend any best practices to consume an webapi from an aspnet mvc app ?

What I whant to do is:

Create an Web Api with my business rules inside it.
One or more mvc apps that  will consume the web api and work.

So whats the best approach to do it ?

All mvc project referencing the webapi to use the namespace, and the webapi published ?

Independent projects that use each other ? any reference on how to start with ?

Diego Garcia

Before using MVC with WebApi, its recommended for you to learn more about basic this applications. Please refer this link to avoid mistake using this application for various purpose :

First of all thanks @teguhyuliantos, but I’ve alread seen this the articles and videos at this url. 

What I’m asking here its for recommendation on best approaches if it already has any available.

Diego Garcia. 

It is my humble opinion, but i am not using much MVC features such as viewbags or modelstates in the projects. In MVC3 i simply write JSonResult controller which passes JSON to the view and adapt the content to it with Javascript. Frontend with who i was
working before prefered it that way and it makes sense to me. Write controllers with returning JSON and it would be easier after to create mobile app or mobile web. I hope it helps :)

Nice tip @PredragPejic I will make some research about it :)

Just some questions, how are you posting changes with that away to work ? are you maping the control names by hand at the view with javascript so it could work as it normaly do ? are you using any javascript framework to do it ? like sencha, kendoui, etc

Diego Garcia 

Pls follow these links:


For quick summary and navigation of all above best practices from different authors you can visit:

Leave a Reply