public async Task GetCharactersForMenu(AuthorizationTokenContainer ctr) { GetPlayerByAccessTokenResponse playerByAccessTokenResponse = _authService.GetPlayerByAccessToken(ctr.Token); if (playerByAccessTokenResponse.Success == true) { GetCharactersByPlayerIdResponse getCharactersByPlayerIdResponse = _gameService.GetCharactersByPlayerId(playerByAccessTokenResponse.Player.Id); if (getCharactersByPlayerIdResponse.Success) { var result = new GetCharactersForMenuResult(getCharactersByPlayerIdResponse.Characters); await Clients.Caller.ReceiveCharactersForMenu(result); } } }
public GetCharactersByPlayerIdResponse GetCharactersByPlayerId(Guid playerId) { var result = new GetCharactersByPlayerIdResponse(); result.Characters = new List <Character>(); result.Characters.AddRange(_wrapper.CharacterRepository.GetAll <Character>(f => f.PlayerId == playerId)); if (result.Characters.Count > 0) { result.Success = true; } else { result.Success = false; } result.PlayerId = playerId; return(result); }