Why do we need Web-Api? [closed]
- by user437973
I was just wondering what the deal is with Asp.net Web-Api. Why did we need a separate type of controller in order to facilitate varying content types for action results? Why wasn't this capability just baked into the ASP.Net MVC base controller?
Anyway, I was just wondering if there was a compelling reason to use both types of controllers within the same project, assuming that the project was being freshly created, or if this project structure was due to an inherent technical limitation. Would it be possible to have ApiControllers fulfill the purpose of an MVC Controller in all cases by just serving HTML when that is the specified accept type?
It just seems to me like a lot of unnecessary repetition to have to re-implement the same types of actions using both types of controllers if you want those actions to be available to your web application through the API and through the web interface.