Exemplo n.º 1
0
        public async Task <ArenaResultsViewModel> GetArenaResultsAsync(int id)
        {
            var model = await _data.Find_ResultAsync(id);

            if (model == null)
            {
                throw new OperationFailedException("El resultado no existe", OperationErrorStatus.ResourceNotFound);
            }

            return(_profilerService.GetArenaResultsViewModel(model.ElapsedMiliseconds,
                                                             model.BattleRecords
                                                             .OrderByDescending(record => record.Order)
                                                             .Select(record => $"{record.ChallengerPokemonId}-{record.ChallengedPokemonId}")
                                                             .ToList(),
                                                             model.InitialStateId, model.FinalStateId));
        }
Exemplo n.º 2
0
 public Task <ArenaResultsViewModel> FullArenaSearchAsync(List <string> pkmnNames)
 => Task.Run(() => ArenaSearch(pkmnNames,
                               (searchResults, elapsedTime, initialId, goalId) =>
                               _profilerService.GetArenaResultsViewModel(elapsedTime,
                                                                         searchResults.Select(result => ((PokemonRankViewModel)result).Battle).ToList(),
                                                                         initialId, goalId)));