Beispiel #1
0
        public async Task <IActionResult> DeleteSeason([FromRoute] short year)
        {
            try
            {
                await _teamsService.DeleteAllTeamsFromSeasonAsync(year);

                _logger.LogDebug($"Teams from {year} deleted.");
                //TODO get seasons and rounds
                byte season = 2;
                for (byte round = 1; round < 5; round++)
                {
                    await _matchesService.DeleteAllMatchesFromSeasonRoundAsync(year, season, round);

                    _logger.LogDebug($"Matches from {year}#{season}#{round} deleted.");
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error deleting season {year}.", ex);
                return(StatusCode(StatusCodes.Status500InternalServerError, $"Error cleaning season {year}."));
            }
        }