public static string PortraitUrl(this IIdentity identity, EveImageHelper.CharacterAvatarSize imageSize = EveImageHelper.CharacterAvatarSize.Two_Fifty_Six) { var characterId = ((ClaimsIdentity)identity).FindFirst(ClaimTypes.NameIdentifier).Value; var avatarUri = EveImageHelper.GetCharacterAvatar(characterId, imageSize); return(avatarUri.ToString()); }
public static string AvatarUrl(this ClaimsPrincipal identity, UserManager <ApplicationUser> userManager, EveImageHelper.CharacterAvatarSize imageSize = EveImageHelper.CharacterAvatarSize.Two_Fifty_Six) { string avatarUrl = string.Empty; var characterId = userManager.GetUserAsync(identity).Result.PrimaryCharacterId; if (string.IsNullOrEmpty(characterId)) { avatarUrl = "/images/guest.png"; } else { avatarUrl = EveImageHelper.GetCharacterAvatar(characterId, imageSize).ToString(); } return(avatarUrl); }