File tree Expand file tree Collapse file tree 8 files changed +17
-18
lines changed
AbpCompanyName.AbpProjectName.Application
AbpCompanyName.AbpProjectName.Web.Mvc
Shared/Components/TenantChange Expand file tree Collapse file tree 8 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public override void Initialize()
2323
2424 Configuration . Modules . AbpAutoMapper ( ) . Configurators . Add (
2525 // Scan the assembly for classes which inherit from AutoMapper.Profile
26- cfg => cfg . AddProfiles ( thisAssembly )
26+ cfg => cfg . AddMaps ( thisAssembly )
2727 ) ;
2828 }
2929 }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public async Task<IActionResult> Index()
3636 public async Task < ActionResult > EditRoleModal ( int roleId )
3737 {
3838 var output = await _roleAppService . GetRoleForEdit ( new EntityDto ( roleId ) ) ;
39- var model = new EditRoleModalViewModel ( output ) ;
39+ var model = ObjectMapper . Map < EditRoleModalViewModel > ( output ) ;
4040
4141 return View ( "_EditRoleModal" , model ) ;
4242 }
Original file line number Diff line number Diff line change @@ -7,11 +7,6 @@ namespace AbpCompanyName.AbpProjectName.Web.Models.Roles
77 [ AutoMapFrom ( typeof ( GetRoleForEditOutput ) ) ]
88 public class EditRoleModalViewModel : GetRoleForEditOutput , IPermissionsEditViewModel
99 {
10- public EditRoleModalViewModel ( GetRoleForEditOutput output )
11- {
12- output . MapTo ( this ) ;
13- }
14-
1510 public bool HasPermission ( FlatPermissionDto permission )
1611 {
1712 return GrantedPermissionNames . Contains ( permission . Name ) ;
Original file line number Diff line number Diff line change 33@{
44 Layout = null ;
55}
6- @Html.Partial ( "~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditRole")))
6+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditRole")))
77
88<div class =" modal-body" >
99 <form name =" RoleEditForm" role =" form" novalidate class =" form-validation" >
5858 </form >
5959</div >
6060
61- @Html.Partial ( "~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
61+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
6262
6363<script src =" ~/view-resources/Views/Roles/_EditRoleModal.js" asp-append-version =" true" ></script >
Original file line number Diff line number Diff line change 11using System . Threading . Tasks ;
22using Microsoft . AspNetCore . Mvc ;
33using Abp . AutoMapper ;
4+ using Abp . ObjectMapping ;
45using AbpCompanyName . AbpProjectName . Sessions ;
56
67namespace AbpCompanyName . AbpProjectName . Web . Views . Shared . Components . TenantChange
78{
89 public class TenantChangeViewComponent : AbpProjectNameViewComponent
910 {
1011 private readonly ISessionAppService _sessionAppService ;
12+ private readonly IObjectMapper _objectMapper ;
1113
12- public TenantChangeViewComponent ( ISessionAppService sessionAppService )
14+ public TenantChangeViewComponent ( ISessionAppService sessionAppService ,
15+ IObjectMapper objectMapper )
1316 {
1417 _sessionAppService = sessionAppService ;
18+ _objectMapper = objectMapper ;
1519 }
1620
1721 public async Task < IViewComponentResult > InvokeAsync ( )
1822 {
1923 var loginInfo = await _sessionAppService . GetCurrentLoginInformations ( ) ;
20- var model = loginInfo . MapTo < TenantChangeViewModel > ( ) ;
24+ var model = _objectMapper . Map < TenantChangeViewModel > ( loginInfo ) ;
2125 return View ( model ) ;
2226 }
2327 }
Original file line number Diff line number Diff line change 55@{
66 Layout = null ;
77}
8- @Html.Partial ( "~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("ChangeTenant")))
8+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("ChangeTenant")))
99
1010<div class =" modal-body" >
1111 <form name =" TenantChangeForm" role =" form" novalidate class =" form-validation" >
1212 <div class =" form-group form-float" >
1313 <div class =" form-line" >
14- <input class =" form-control" type =" text" name =" TenancyName" maxlength =" @AbpTenantBase.MaxTenancyNameLength" value =" @Model.TenancyName" >
14+ <input class =" form-control" type =" text" name =" TenancyName" maxlength =" @AbpTenantBase.MaxTenancyNameLength.ToString() " value =" @Model.TenancyName" >
1515 <label class =" form-label" >@L( "TenancyName")</label >
1616 </div >
1717 </div >
1818 <span class =" help-block" >@L( "LeaveEmptyToSwitchToHost")</span >
1919 </form >
2020</div >
2121
22- @Html.Partial ( "~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
22+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
2323
2424<script src =" ~/view-resources/Views/Shared/Components/TenantChange/_ChangeModal.js" asp-append-version =" true" ></script >
Original file line number Diff line number Diff line change 55@{
66 Layout = null ;
77}
8- @Html.Partial ( "~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditTenant")))
8+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditTenant")))
99
1010<div class =" modal-body" >
1111 <form name =" TenantEditForm" role =" form" novalidate class =" form-validation" >
3131 </form >
3232</div >
3333
34- @Html.Partial ( "~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
34+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
3535
3636<script src =" ~/view-resources/Views/Tenants/_EditTenantModal.js" asp-append-version =" true" ></script >
Original file line number Diff line number Diff line change 33@{
44 Layout = null ;
55}
6- @Html.Partial ( "~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditUser")))
6+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditUser")))
77
88<div class =" modal-body" >
99 <form name =" UserEditForm" role =" form" novalidate class =" form-validation" >
8686 </form >
8787</div >
8888
89- @Html.Partial ( "~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
89+ @await Html.PartialAsync ("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")
9090
9191<script src =" ~/view-resources/Views/Users/_EditUserModal.js" asp-append-version =" true" ></script >
You can’t perform that action at this time.
0 commit comments