Example #1
0
        public async Task <int> CreateRandomArenaAsync(int pkmnCount)
        {
            var arenaResults = await _rankSearchService.RandomArenaResultsAsync(pkmnCount);

            var resource = arenaResults.ToEntity();

            _data.AddResult(resource);
            var success = await _data.SaveAllAsync();

            if (!success)
            {
                throw new OperationFailedException("Error al insertar el recurso", OperationErrorStatus.DatabaseError);
            }
            return(resource.Id);
        }
Example #2
0
 public async Task <IActionResult> GetRandomArenaResults([FromQuery] int pkmnCount = 50)
 => await this.Get(async() => await _rankSearchService.RandomArenaResultsAsync(pkmnCount));