Beispiel #1
0
        public List <GameStats> GetStats(
            int playerId,
            int season,
            params int[] weeks)
        {
            var plyr = GetPlayer(playerId.ToString());
            var pm   = new PlayerReportModel
            {
                PlayerName = plyr.Name,
                Season     = season.ToString(),
                Position   = plyr.Position
            };

            var seasonStats = StatsRepo.GetStats(pm);
            var stats       = seasonStats.Where(s => weeks.Contains(s.Week));

            if (stats.Any())
            {
                return(stats.ToList());
            }
            // send an empty box
            var emptyStats = new List <GameStats>();

            foreach (var w in weeks)
            {
                emptyStats.Add(
                    new GameStats
                {
                    Week = w
                });
            }
            return(emptyStats);
        }
Beispiel #2
0
        private void ScorePlayer(
            Player plyr)
        {
            var pm = new PlayerReportModel
            {
                PlayerName = plyr.Name,
                Season     = "1988",
                Position   = plyr.Position
            };
            var stats88 = StatsRepo.GetStats(pm);
            var tds     = stats88.Sum(s => s.Scores());

            plyr.CurrentScores = tds;
            pm.Season          = "1989";
            var stats89 = StatsRepo.GetStats(pm);

            tds = stats89.Sum(s => s.Scores());
            plyr.FutureScores = tds;
            plyr.Points       = plyr.CurrentScores + plyr.FutureScores;
        }
Beispiel #3
0
        public void TallyPlayer(
            Player plyr,
            string thisSeason = "1988",
            string nextSeason = "1989")
        {
            var pm = new PlayerReportModel
            {
                PlayerName = plyr.Name,
                Season     = thisSeason,
                Position   = plyr.Position
            };
            var stats88 = StatsRepo.GetStats(pm);
            var tds     = stats88.Sum(s => s.Scores());

            plyr.CurrentScores = tds;
            pm.Season          = nextSeason;
            var stats89 = StatsRepo.GetStats(pm);

            tds = stats89.Sum(s => s.Scores());
            plyr.FutureScores = tds;
            plyr.Points       = plyr.CurrentScores + plyr.FutureScores;
        }