我目前的应用结构如下:
Controller
UserAdminController
GroupsAdminController
我想以每个管理组的方式修改它,我有自己的文件夹。例如:
Controller
UserAdmin
-UserAdminController
GroupAdmin
-GroupAdminController
在我看来,我想指出特定控制器的行动:
@Html.ActionLink("User Administration", "Index","/UserAdmin/UserAdmin")
@Html.ActionLink("Group Administration", "Index", "/GroupAdmin/GroupAdmin")
我该怎么办?
答案 0 :(得分:1)
您可以通过多种方式执行此操作,但我建议您阅读并使用gradle artifactory plugin docs。
$ls -l
drwxr-xr-x 2 root root 1515 Apr 8 01:36 File1
drwxr-xr-x 2 root root 1515 Apr 8 01:49 File1
drwxr-xr-x 2 root root 2343 Apr 8 01:54 File3
drwxr-xr-x 2 root root 2303 Apr 8 01:59 File4
drwxr-xr-x 2 root root 2303 Apr 8 01:59 Another_File1
此外,ActionLink有许多可以使用的重载(“text”,“action”,“controller”,route values)如下:
Areas
UserAdmin
Controller
-UserAdminController
GroupAdmin
Controller
-GroupAdminController
另一种选择是为Admin提供一个区域,只有两个控制器。请记住,每个控制器都有自己的视图文件夹:
@Html.ActionLink("User Administration", "Index","UserAdmin", new { area="UserAdmin" })
@Html.ActionLink("Group Administration", "Index", "GroupAdmin", new { area="GroupAdmin" })
然后你的ActionLinks将是:
Areas
Admin
Controllers
UserController
GroupController
Views
User
Index.cshtml
Group
Index.cshtml
链接也会更好恕我直言:
@Html.ActionLink("User Administration", "Index","User", new { area="Admin" })
@Html.ActionLink("Group Administration", "Index", "Group", new { area="Admin" })