Example #1
0
 public Season(IEnumerable<Week> weeks, League league)
 {
     Weeks = weeks.ToList();
     foreach (var week in weeks)
     {
         week.Season = this;
     }
     League = league;
 }
Example #2
0
        public static Season CreateSeason(DateTime current, League league)
        {
            var weeks = new List<Week>(10);
            for (int i = 0; i < 10; i++)
            {
                DateTime weekStart = current.AddDays(7 * i);
                var week = CreateWeek(weekStart);
                weeks.Add(week);
            }

            var newSeason = new Season(weeks, league);

            league.Seasons.Add(newSeason);

            return newSeason;
        }
Example #3
0
        public StatsModelView(League _league)
        {
            currentSeason = _league.GetCurrentSeason();
            var Allplayers = _league.Seasons.GetActiveSeasons().First().GetLivePlayers();
            PlayerCount = Allplayers.Count();
            ThisWeek = currentSeason.GetCurrentWeekSeason();
            if(ThisWeek != null){
                PlayerPredictions = ThisWeek.GetPlayerPredications();

                PlayerPredictionsCount = PlayerPredictions.Count();
                MatchesCount = ThisWeek.Matches.Count();
                AwaitingPredictions = (PlayerCount * MatchesCount) - PlayerPredictionsCount;

                PlayersStats = Allplayers.Select(p => CreateRow(p, MatchesCount)).ToArray();
            }
        }
Example #4
0
        public User CreatePlayer(League playersleague)
        {
            //create users first
            var newUser = new User
            {
                Email = Email,
                Password = Password,
                Live = true,
                Created = SystemDate.Current(),
                Updated = SystemDate.Current(),
                ActivationCode = GetHashCode()
            };

             //create the player next
            var newPlayer = new Player
            {
                Name = Username,
                User = newUser
            };

            //add player to the league
            playersleague.Players.Add(newPlayer);

            return newUser;
        }