public async Task <OperationResponse> AllocationRoleAsync(UserAllocationRoleInputDto dto) { dto.NotNull(nameof(dto)); var user = await _userManager.FindByIdAsync(dto.Id.ToString()); return(await _unitOfWork.UseTranAsync(async() => { if (dto.RoleIds?.Any() == true) { return await this.SetUserRoles(user, dto.RoleIds, false); } else { return await this.DeleteUserRoleAsync(user); } })); }
public async Task <AjaxResult> AllocationRoleAsync([FromBody] UserAllocationRoleInputDto dto) { return((await _userService.AllocationRoleAsync(dto)).ToAjaxResult()); }