Exemplo n.º 1
0
        private Season InsertSeasonAndCompetitionSchedule(IUnitOfWorkRepository repository, SeasonAndCompetitionSchedules seasonAndCompetitionSchedules)
        {
            // Insert the season.
             repository.RegisterInsert(seasonAndCompetitionSchedules.Season);

             // Insert league schedules.
             SaveCompetitionSchedule(seasonAndCompetitionSchedules.LeaguesSchedule, repository);

             // Insert cup schedule.
             SaveCompetitionSchedule(seasonAndCompetitionSchedules.NationalCupSchedule, repository);

             // Insert super cup schedule.
             SaveCompetitionSchedule(seasonAndCompetitionSchedules.NationalSuperCupSchedule, repository);

             // Insert pre-season friendly schedule.
             SaveCompetitionSchedule(seasonAndCompetitionSchedules.PreSeasonFriendliesSchedule, repository);

             // Update the teams.
             repository.RegisterUpdate(seasonAndCompetitionSchedules.Teams);

             return seasonAndCompetitionSchedules.Season;
        }
Exemplo n.º 2
0
        public void EndSeason(string seasonId, IUnitOfWorkRepository repository)
        {
            var repositoryFactory = new RepositoryFactory();

             // End the season by updating the status.
             using (var seasonRepository = repositoryFactory.CreateSeasonRepository())
             {
            var season = seasonRepository.GetOne(seasonId);
            season.SeasonStatus = SeasonStatus.Ended;
            repository.RegisterUpdate(season);
             }

             // Update the season's statistics.
             var seasonStatisticsManager = new SeasonStatisticsManager(repository);
             seasonStatisticsManager.Update(seasonId);
        }