public async Task <IActionResult> GetUserAsync([FromRoute] Guid id) { var requestUser = new GetUserRequest { Id = id, }; var responseUser = await _authorizationClient.GetUserAsync(requestUser); var requestRoles = new ListRolesRequest(); var responseRoles = await _authorizationClient.ListRolesAsync(requestRoles); var result = new GetUserOutput { User = new UserDetail { Id = responseUser.Id, UserName = responseUser.UserName, Name = responseUser.Name, DisplayName = responseUser.DisplayName, IsEnabled = responseUser.IsEnabled, RoleIds = responseUser.RoleIds .Select(x => (Guid)x) .ToList(), }, Roles = responseRoles.Items .Select(x => new NamedEntityResult { Id = x.Id, Name = x.Name }) .ToList(), }; return(Ok(result)); }
public async Task <ActionResult> Index() { GetUserOutput user = null; if (AbpSession.UserId.HasValue) { user = await _iUserAppService.GetUserAsync(AbpSession.UserId.Value); } var tentant = await _tenantManager.GetByIdAsync(AbpSession.TenantId.Value); var role = await _iUserAppService.GetRoleAsync(AbpSession.UserId.Value); return(View(new HomeUserViewModel { ProfilePhoto = user.ProfilePhoto, Surname = user.Surname, TenancyName = tentant.TenancyName, RoleName = role.DisplayName })); }
public async Task <IActionResult> GetNewUserAsync() { var requestRoles = new ListRolesRequest(); var responseRoles = await _authorizationClient.ListRolesAsync(requestRoles); var result = new GetUserOutput { User = new UserDetail { IsEnabled = true, }, Roles = responseRoles.Items .Select(x => new NamedEntityResult { Id = x.Id, Name = x.Name }) .ToList(), }; return(Ok(result)); }
public void Standart(GetUserOutput output) { ViewModel = new OkObjectResult(output.User); }