Example #1
0
        protected override async Task OnInitializedAsync()
        {
            allroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
            await LoadSettingsAsync();

            userroles = Search(_search);
        }
        private async Task GetUserRoles()
        {
            try
            {
                userroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);

                userroles = userroles.Where(item => item.UserId == userid).ToList();
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Loading User Roles {UserId} {Error}", userid, ex.Message);

                AddModuleMessage("Error Loading User Roles", MessageType.Error);
            }
        }
        protected override async Task OnInitializedAsync()
        {
            try
            {
                roleid = Int32.Parse(PageState.QueryString["id"]);
                Role role = await RoleService.GetRoleAsync(roleid);

                name  = role.Name;
                users = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);

                users = users.Where(item => item.Role.Name == Constants.RegisteredRole).ToList();
                await GetUserRoles();
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Loading Users {Error}", ex.Message);

                AddModuleMessage("Error Loading Users", MessageType.Error);
            }
        }