I am developing an ASP.NET MVC application, that has a lot of client side interaction ie. a lot of ajax calls to controller actions.
Currently I have controllers containing actions (part of the same controller) returning both views and data (json/xml), I am considering is it a good practice to have actions returning data and views under one controller.
For example under
/Controllers/CarsController/
public ActionView Index()
public ActionView Car(int carID)
public ActionResult CarMakes()
public ActionResult CarModels(int makeID)
/Controllers/StoresController
public ActionView Index()
public ActionView Store(int storeID)
public ActionResult Cities()
public ActionResult Stores()
This is one way of thinking, and the other would be
/Controllers/CarsController/
public ActionView Index()
public ActionView Car(int carID)
/Controllers/StoresController
public ActionView Index()
public ActionView Store(int storeID)
/Controllers/ServicesController
public ActionResult CarMakes()
public ActionResult CarModels(int makeID)
public ActionResult Cities()
public ActionResult Stores()
The second way offers an easier way to find all the available actions that could be used for client side interaction. Actions avoids duplication, could also be reused and called from different controllers (they can be called and reused in either way)
So between these two I would just like to know what is general practice when designing MVC application?