private async Task SetDefaultCharacterAsync(ulong accountId, MySqlConnection conn) { var characters = await CharacterCollector.FindCharactersAsync(accountId); if (characters.Count() > 0) { await SetDefaultCharacterAsync( accountId, characters.First().RealmId, characters.First().Id, characters.First().Name, characters.First().Race, characters.First().Class, characters.First().Level, conn); } else { await conn.ExecuteAsync( "UPDATE `pomelo_account` " + "SET `DefaultRealm` = NULL, " + "`DefaultCharacter` = NULL " + "WHERE `Id` = @Id", new { Id = accountId }); } }
public async Task <IActionResult> Index() { var characters = await CharacterCollector.FindCharactersAsync(Account.Id); return(View(characters)); }