protected override async Task OnParametersSetAsync() { if (!string.IsNullOrEmpty(UserId)) { UsernameText = await UserApiService.GetUserNameAsync(UserId); } }
protected override async Task OnParametersSetAsync() { if (Group == null) { Header = string.Empty; } else if (!string.IsNullOrEmpty(Group.Name)) { Header = Group.Name; } else { var members = await GroupService.SecureGetGroupMembersAsync(Group.Id); var maxCount = members.Length > 5 ? 5 : members.Length; var subset = new GroupMember[maxCount]; Array.Copy(members, 0, subset, 0, maxCount); var usernames = new List <string>(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); foreach (var gm in subset) { if (gm.UserId != loggedInUserId) { var username = await UserApiService.GetUserNameAsync(gm.UserId); usernames.Add(username); } } usernames.Sort(); Header = string.Join(", ", usernames.ToArray()); } await base.OnParametersSetAsync(); }
protected override async Task OnParametersSetAsync() { _editContext = new EditContext(Profile); _messages = new ValidationMessageStore(_editContext); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); if (!string.IsNullOrEmpty(loggedInUserId)) { Profile.Slug = await UserApiService.GetUserNameAsync(loggedInUserId); } else { NavigationManager.NavigateTo($"/"); } }
protected override async Task OnParametersSetAsync() { var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); if (string.IsNullOrEmpty(Slug) && !string.IsNullOrEmpty(loggedInUserId)) { Slug = await UserApiService.GetUserNameAsync(loggedInUserId); } if (!string.IsNullOrEmpty(Slug)) { var node = await NodeService.GetBySlugAsync( Constants.ProfilesModule, Constants.ProfileType, Slug); if (node != null) { Profile = Profile.Create(node); var createdBy = node.CreatedBy; CanEditProfile = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ProfilesModule, Constants.ProfileType, Actions.Add ); } else { NavigationManager.NavigateTo("profile/in/new"); } } else { NavigationManager.NavigateTo("/"); } }