Apr 09, 2019 01:42 PM|stevehav|LINK
I'm developing an application that's becoming sizable, in terms of number of views that a given user might interact with.
I started with a handful of controllers, one controller for each major area of functionality for the application (think one for users, called /Users, and one for administrators, called /Admin). Each of these has now grown to where it starts to feel unwieldy
-- the /Users controller has about 50 actions now.
Is there a way to build sub-controllers, so that the routes look nice, like /Users/Settings, so that I can still group related actions into controllers but split them up into logical subgroups?
Ideally, I think, the directory structure and routes would reflect something like:
/Controllers/Users.cs, /Controllers/Users/UserSettings.cs, /Views/Users/Index.cshtml, /Views/Users/Settings/Index.cshtml, and so on.
My other thought was to split them up (UsersController.cs, UsersSettingsController.cs, etc) and then manually specify routes to methods to maintain a nice, logical grouping of routes, but that seems clumsy and easily broken.