0

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.

2
  • 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... Commented Jul 6, 2015 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 Commented Jul 6, 2015 at 18:53

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.