Skip to content

Commit 6f22035

Browse files
committed
Remove static Map code and fix some issues.
1 parent 9e2cad1 commit 6f22035

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

src/AbpCompanyName.AbpProjectName.Application/Sessions/SessionAppService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
using System.Threading.Tasks;
22
using Abp.Auditing;
33
using Abp.AutoMapper;
4+
using Abp.ObjectMapping;
45
using AbpCompanyName.AbpProjectName.Sessions.Dto;
56

67
namespace AbpCompanyName.AbpProjectName.Sessions
78
{
89
public class SessionAppService : AbpProjectNameAppServiceBase, ISessionAppService
910
{
11+
private readonly IObjectMapper _objectMapper;
12+
13+
public SessionAppService(IObjectMapper objectMapper)
14+
{
15+
_objectMapper = objectMapper;
16+
}
17+
1018
[DisableAuditing]
1119
public async Task<GetCurrentLoginInformationsOutput> GetCurrentLoginInformations()
1220
{
1321
var output = new GetCurrentLoginInformationsOutput();
1422

1523
if (AbpSession.UserId.HasValue)
1624
{
17-
output.User = (await GetCurrentUserAsync()).MapTo<UserLoginInfoDto>();
25+
output.User = _objectMapper.Map<UserLoginInfoDto>(await GetCurrentUserAsync());
1826
}
1927

2028
if (AbpSession.TenantId.HasValue)
2129
{
22-
output.Tenant = (await GetCurrentTenantAsync()).MapTo<TenantLoginInfoDto>();
30+
output.Tenant = _objectMapper.Map<TenantLoginInfoDto>(await GetCurrentTenantAsync());
2331
}
2432

2533
return output;

src/AbpCompanyName.AbpProjectName.WebMpa/Controllers/AccountController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public virtual async Task<ActionResult> ExternalLoginCallback(string returnUrl,
374374
return View("TenantSelection", new TenantSelectionViewModel
375375
{
376376
Action = Url.Action("ExternalLoginCallback", "Account", new { returnUrl }),
377-
Tenants = tenants.MapTo<List<TenantSelectionViewModel.TenantInfo>>()
377+
Tenants = ObjectMapper.Map<List<TenantSelectionViewModel.TenantInfo>>(tenants)
378378
});
379379
}
380380
}

src/AbpCompanyName.AbpProjectName.WebSpaAngular/App/Main/views/tenants/createModal.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<form name="tenantCreateForm" novalidate>
33

44
<div class="modal-header">
5-
<button type="button" class="close" aria-label="Close">
5+
<button type="button" class="close" aria-label="Close" ng-click="vm.cancel()" >
66
<span aria-hidden="true">&times;</span>
77
</button>
88
<h4 class="modal-title">

src/AbpCompanyName.AbpProjectName.WebSpaAngular/App/Main/views/tenants/editModal.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<form name="tenantCreateForm" novalidate>
33

44
<div class="modal-header">
5-
<button type="button" class="close" aria-label="Close">
5+
<button type="button" class="close" aria-label="Close" ng-click="vm.cancel()" >
66
<span aria-hidden="true">&times;</span>
77
</button>
88
<h4 class="modal-title">

src/AbpCompanyName.AbpProjectName.WebSpaAngular/Controllers/AccountController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public virtual async Task<ActionResult> ExternalLoginCallback(string returnUrl,
388388
return View("TenantSelection", new TenantSelectionViewModel
389389
{
390390
Action = Url.Action("ExternalLoginCallback", "Account", new { returnUrl }),
391-
Tenants = tenants.MapTo<List<TenantSelectionViewModel.TenantInfo>>()
391+
Tenants = ObjectMapper.Map<List<TenantSelectionViewModel.TenantInfo>>(tenants)
392392
});
393393
}
394394
}

0 commit comments

Comments
 (0)