public async Task <ConnectResult> TestAccountASync(Account account) { ConnectResult result = await _socketRepository.LoginWithAccount(account, true); await using (var db = GetDBContext()) { Character defaultCharacter = db.Characters.FirstOrDefault(x => x.AccountOwnerId == account.Id && x.AllowLogin); account = db.Accounts.Find(account.Id); account.IsConfirmed = result.IsConnected; account.TW2AccountID = result.TW2AccountId; if (defaultCharacter != null) { account.DefaultCharacter = defaultCharacter; account.DefaultCharacterId = defaultCharacter.Id; } db.SaveChanges(); } return(result); }