Browse Source

Entity Extension system applied to tenant management module

ref: https://github.com/volosoft/volo/issues/2084
pull/4861/head
Ahmet Çotur 6 years ago
parent
commit
d4551c83b7
  1. 4
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebAutoMapperProfile.cs
  2. 5
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml
  3. 1
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs
  4. 16
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml

4
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebAutoMapperProfile.cs

@ -13,11 +13,11 @@ namespace Volo.Abp.TenantManagement.Web
//CreateModal //CreateModal
CreateMap<CreateModalModel.TenantInfoModel, TenantCreateDto>() CreateMap<CreateModalModel.TenantInfoModel, TenantCreateDto>()
.Ignore(x => x.ExtraProperties); .MapExtraProperties();
//EditModal //EditModal
CreateMap<EditModalModel.TenantInfoModel, TenantUpdateDto>() CreateMap<EditModalModel.TenantInfoModel, TenantUpdateDto>()
.Ignore(x => x.ExtraProperties); .MapExtraProperties();
} }
} }
} }

5
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml

@ -1,4 +1,5 @@
@page @page
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.Extensions.Localization @using Microsoft.Extensions.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Abp.Localization @using Volo.Abp.Localization
@ -6,14 +7,14 @@
@using Volo.Abp.TenantManagement.Localization @using Volo.Abp.TenantManagement.Localization
@using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants @using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
@model CreateModalModel @model CreateModalModel
@inject IStringLocalizer<AbpTenantManagementResource> L @inject IHtmlLocalizer<AbpTenantManagementResource> L
@inject IStringLocalizerFactory StringLocalizerFactory @inject IStringLocalizerFactory StringLocalizerFactory
@{ @{
Layout = null; Layout = null;
} }
<form method="post" asp-page="/TenantManagement/Tenants/CreateModal"> <form method="post" asp-page="/TenantManagement/Tenants/CreateModal">
<abp-modal> <abp-modal>
<abp-modal-header title="@L["NewTenant"]"></abp-modal-header> <abp-modal-header title="@L["NewTenant"].Value"></abp-modal-header>
<abp-modal-body> <abp-modal-body>
<abp-input asp-for="Tenant.Name" /> <abp-input asp-for="Tenant.Name" />

1
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs

@ -20,6 +20,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
public virtual Task<IActionResult> OnGetAsync() public virtual Task<IActionResult> OnGetAsync()
{ {
Tenant = new TenantInfoModel();
return Task.FromResult<IActionResult>(Page()); return Task.FromResult<IActionResult>(Page());
} }

16
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml

@ -20,9 +20,19 @@
<abp-input asp-for="Tenant.Name" label="@L["TenantName"].Value" /> <abp-input asp-for="Tenant.Name" label="@L["TenantName"].Value" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<EditModalModel.TenantInfoModel>()) @foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<EditModalModel.TenantInfoModel>())
{ {
<abp-input type="@propertyInfo.GetInputType()" if (propertyInfo.Type.IsEnum)
asp-for="Tenant.ExtraProperties[propertyInfo.Name]" {
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" /> <abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"></abp-select>
}
else
{
<abp-input type="@propertyInfo.GetInputType()"
asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
asp-format="@propertyInfo.GetInputFormatOrNull()"
value="@propertyInfo.GetInputValueOrNull(Model.Tenant.ExtraProperties[propertyInfo.Name])" />
}
} }
</abp-modal-body> </abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer> <abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>

Loading…
Cancel
Save