Esempio n. 1
0
        public async Task OnGetAsync()
        {
            var id         = _manager.GetUserId(User);
            var systemUser = await _manager.FindByIdAsync(id);

            var claims = await _manager.GetClaimsAsync(systemUser);

            EditProfileViewModel = new EdiProfileViewModel(systemUser, claims);
            Cultures             = CultureInfo.GetCultures(CultureTypes.SpecificCultures).OrderBy(c => c.Name).ToDictionary(c => c.Name, c => $"{c.Name } - {c.NativeName}");
            TimeZones            = TimeZoneInfo.GetSystemTimeZones().ToDictionary(t => t.Id, t => t.DisplayName);
        }
        public async Task OnGetAsync(Guid id)
        {
            var user = await _userManager.FindByIdAsync(id.ToString());

            var userClaims = await _userManager.GetClaimsAsync(user);

            var userRoles = await _userManager.GetRolesAsync(user);

            Id                   = id.ToString();
            Username             = user.UserName;
            EditProfileViewModel = new EdiProfileViewModel(user, userClaims);
            RoleChecks           = _roleManager.Roles.ToDictionary(k => k.Name, v => userRoles.Contains(v.Name));
            Cultures             = CultureInfo.GetCultures(CultureTypes.SpecificCultures).OrderBy(c => c.Name).ToDictionary(c => c.Name, c => $"{c.Name } - {c.NativeName}");
            TimeZones            = TimeZoneInfo.GetSystemTimeZones().ToDictionary(t => t.Id, t => t.DisplayName);
        }