|
@ -49,6 +49,27 @@ public class DepartmentAppService |
|
|
var deptDto = await GetByCodeAsync(departmentCode).ConfigureAwait(false); |
|
|
var deptDto = await GetByCodeAsync(departmentCode).ConfigureAwait(false); |
|
|
return deptDto; |
|
|
return deptDto; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[AllowAnonymous] |
|
|
|
|
|
[HttpGet("by-userid")] |
|
|
|
|
|
public virtual async Task<DepartmentDTO> GetByUserIdAsync(string userId) |
|
|
|
|
|
{ |
|
|
|
|
|
var user = await _identityUserManager.FindByIdAsync(userId).ConfigureAwait(false); |
|
|
|
|
|
if (user == null) |
|
|
|
|
|
{ |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var departmentCode = user.GetDepartmentCode(); |
|
|
|
|
|
if (string.IsNullOrEmpty(departmentCode)) |
|
|
|
|
|
{ |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var deptDto = await GetByCodeAsync(departmentCode).ConfigureAwait(false); |
|
|
|
|
|
return deptDto; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
[AllowAnonymous] |
|
|
[AllowAnonymous] |
|
|
[HttpPost("update")] |
|
|
[HttpPost("update")] |
|
|
public virtual async Task UpdateAsync(DepartmentCreateInput input) |
|
|
public virtual async Task UpdateAsync(DepartmentCreateInput input) |
|
|