Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I have built an ASP.NET Web API project that feeds data from a SQL server database to a an existing website. There will other websites that will start consuming this Web API in the near future. When the Web API was built, the requirement was to just provide a number of GET operations; no updates/edits were required. Now, the client wants an admin tool/interface where they can manipulate the data (make some edits and apply some tagging) before the data is served up to the websites.

The question I have is that should I build a new ASP.NET MVC 4 site (new solution) that allows the client to manipulate the data? My thoughts were that if I go with this approach, I would expand the existing Web API project and implement some put operations as well as add support to return data based on some filters. I would then consume the Web API from the new ASP.NET MVC 4 application. The downside with this approach is that I will now have duplicated code, particularly, I will have to create my model classes in the MVC 4 web app and keep it consistent with the Web API project. Is this a correct assumption?

Or should I just build the interface in the Web API project? What are the pros and cons of doing that? Any insight would be appreciated.

share|improve this question
    
if my web api is going to consume by more than one project than i create seprate wpi project which should be cosume by both project... – Pranay Rana Jul 6 at 18:29
    
routing can be a pain when you combine a web api and mvc project into one project. you might want to research that before making your decision – JamieD77 Jul 6 at 18:53

Create a project for your models, and use that project as a reference in each of your projects.

Your MVC application should just be creating views, and authorization. You should be using the views to call the API functions

share|improve this answer

Another downside to the two-solutions approach is that you'd have the added latency of making requests from the admin site to your API. Still, if you go that route, you can move your model classes into a common library that you reference from both your Web API site and your MVC 4 site.

Building an admin tool in the same solution is a perfectly valid approach.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.