public void PlayWeek()
        {
            GameDocument game = _gameService.Get();

            if (game.NextWeekType == WeekType.RegularSeason)
            {
                List <FixturesDocument> fixtures = _fixturesService.GetThisWeeksFixtures(game.Season, game.Week);

                foreach (var fixture in fixtures)
                {
                    PlayGame(fixture.Id);
                    UpdateResult(fixture.Id, game.Season);
                }

                UpdateDivisionRankings();
                UpdateScheduleStrength();
            }


            var nextWeek         = game.Week + 1;
            var nextWeekGameType = game.NextWeekType;

            if (nextWeek > RegularSeasonLength)
            {
                UpdateFinalsFixtures();
                nextWeekGameType = WeekType.DivisionalFinals;
            }

            _gameService.NewWeek(nextWeek, nextWeekGameType);
        }
        public void PlayChampionship()
        {
            GameDocument game = _gameService.Get();

            if (game.NextWeekType == WeekType.Championship)
            {
                List <FixturesDocument> fixtures = _fixturesService.GetThisWeeksFixtures(game.Season, game.Week);

                foreach (var fixture in fixtures)
                {
                    PlayGame(fixture.Id);
                }
            }

            var nextWeek         = game.Week + 1;
            var nextWeekGameType = WeekType.EndSeason;

            _gameService.NewWeek(nextWeek, nextWeekGameType);
        }
Esempio n. 3
0
 public ActionResult <FixturesDocument> GetThisWeeksFixtures(int season, int week)
 {
     return(Ok(_fixturesService.GetThisWeeksFixtures(season, week)));
 }