public IActionResult Profile(string id) { var player = _databaseService.GetPlayer(string.IsNullOrWhiteSpace(id) ? ulong.Parse(User.Claims.First().Value) : ulong.Parse(id)); if (string.IsNullOrWhiteSpace(player.Avatar)) { player.Avatar = _discordService.GetAvatarUrl(player.Id); _databaseService.UpdateAvatar(player.Id, player.Avatar); } ViewBag.Player = player; return(View()); }
public IActionResult Index() { var players = _databaseService.GetAllPlayers(); foreach (var p in players) { if (string.IsNullOrWhiteSpace(p.Avatar)) { p.Avatar = _discordService.GetAvatarUrl(p.Id); _databaseService.UpdateAvatar(p.Id, p.Avatar); } } ViewBag.Players = players; return(View()); }