Skip to content

Commit e328388

Browse files
committed
Created Tenant list page.
1 parent 96b2674 commit e328388

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

src/AbpCompanyName.AbpProjectName.WebMpa/AbpCompanyName.AbpProjectName.WebMpa.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@
396396
<Compile Include="Controllers\AccountController.cs" />
397397
<Compile Include="Controllers\HomeController.cs" />
398398
<Compile Include="Controllers\Results\ChallengeResult.cs" />
399+
<Compile Include="Controllers\TenantsController.cs" />
399400
<Compile Include="Models\Layout\UserMenuOrLoginLinkViewModel.cs" />
400401
<Compile Include="Models\Account\LoginFormViewModel.cs" />
401402
<Compile Include="Models\Account\LoginViewModel.cs" />
@@ -427,6 +428,7 @@
427428
<Content Include="Views\Account\RegisterResult.cshtml" />
428429
<Content Include="Views\Account\TenantSelection.cshtml" />
429430
<Content Include="Views\Layout\_UserMenuOrLoginLink.cshtml" />
431+
<Content Include="Views\Tenants\Index.cshtml" />
430432
<None Include="Web.Debug.config">
431433
<DependentUpon>Web.config</DependentUpon>
432434
</None>

src/AbpCompanyName.AbpProjectName.WebMpa/App_Start/AbpProjectNameNavigationProvider.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Abp.Application.Navigation;
22
using Abp.Localization;
3+
using AbpCompanyName.AbpProjectName.Authorization;
34

45
namespace AbpCompanyName.AbpProjectName.WebMpa
56
{
@@ -17,19 +18,32 @@ public override void SetNavigation(INavigationProviderContext context)
1718
.AddItem(
1819
new MenuItemDefinition(
1920
"Home",
20-
new LocalizableString("HomePage", AbpProjectNameConsts.LocalizationSourceName),
21+
L("HomePage"),
2122
url: "/",
2223
icon: "fa fa-home",
2324
requiresAuthentication: true
2425
)
26+
).AddItem(
27+
new MenuItemDefinition(
28+
"Tenants",
29+
L("Tenants"),
30+
url: "/Tenants",
31+
icon: "fa fa-globe",
32+
requiredPermissionName: PermissionNames.Pages_Tenants
33+
)
2534
).AddItem(
2635
new MenuItemDefinition(
2736
"About",
28-
new LocalizableString("About", AbpProjectNameConsts.LocalizationSourceName),
37+
L("About"),
2938
url: "/About",
3039
icon: "fa fa-info"
3140
)
3241
);
3342
}
43+
44+
private static ILocalizableString L(string name)
45+
{
46+
return new LocalizableString(name, AbpProjectNameConsts.LocalizationSourceName);
47+
}
3448
}
3549
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Web.Mvc;
2+
using Abp.Web.Mvc.Authorization;
3+
using AbpCompanyName.AbpProjectName.Authorization;
4+
using AbpCompanyName.AbpProjectName.MultiTenancy;
5+
6+
namespace AbpCompanyName.AbpProjectName.WebMpa.Controllers
7+
{
8+
[AbpMvcAuthorize(PermissionNames.Pages_Tenants)]
9+
public class TenantsController : AbpProjectNameControllerBase
10+
{
11+
private readonly ITenantAppService _tenantAppService;
12+
13+
public TenantsController(ITenantAppService tenantAppService)
14+
{
15+
_tenantAppService = tenantAppService;
16+
}
17+
18+
public ActionResult Index()
19+
{
20+
var output = _tenantAppService.GetTenants();
21+
return View(output);
22+
}
23+
}
24+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@model Abp.Application.Services.Dto.ListResultOutput<AbpCompanyName.AbpProjectName.MultiTenancy.Dto.TenantListDto>
2+
@{
3+
ViewBag.ActiveMenu = "Tenants"; //The menu item will be active for this page.
4+
}
5+
<div>
6+
<h1>@L("Tenants")</h1>
7+
<div class="row">
8+
<div class="col-md-12">
9+
<button ng-click="vm.openTenantCreationModal()" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> @L("CreateNewTenant")</button>
10+
<table class="table">
11+
<thead>
12+
<tr>
13+
<th>@L("TenancyName")</th>
14+
<th>@L("Name")</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
@foreach (var tenant in Model.Items)
19+
{
20+
<tr>
21+
<td>@tenant.TenancyName</td>
22+
<td>@tenant.Name</td>
23+
</tr>
24+
}
25+
</tbody>
26+
</table>
27+
</div>
28+
</div>
29+
</div>

0 commit comments

Comments
 (0)