I’ve been playing around with ASP.NET MVC 4 beta and I noticed two controllers: one(web api controller) to return data and the other(default controller) to return views.
I’m aware that even HTML is a type of representation for a resource like JSON or XML and I’m not personally so happy having a separate controller to return only HTML representation.
What I’m trying to achieve is having a single controller that will return both views and data. But I’m confused is this a best option and if it is how can I achieve this without much code.
Can I extend the ApiController such that it will return both views as well as data or can I create a generic controller that by passes the requests to particular controller type based upon the "accept-type".
I’m looking for your valuable suggestions.
Write a formatter rendering your HTML.