When your site grows in size, you should create new controller classes instead of putting
all actions to IndexController
. The Index controller is used for defining the actions
which work for your entire site.
It is not recommended to create huge controllers with hundreds of actions, because they are difficult to understand and support.
It is recommended to create new controller class for each model (or for most important ones) of your business logic domain.
For example, you can create UserController
to manage users of your site.
This controller would have the default "index" action for displaying the page
with all users, "add" action for adding a new user, "edit" action for editing
user's profile and "delete" action for deleting the user.
By analogy, you would create PurchaseController
and its actions to manage the purchases of your products
and implementing the shopping cart, DownloadController
and its actions to manage file downloads for the site,
etc.