Example #1
0
        private int KickerStats(
            Player player,
            Round round)
        {
            var pts   = 0;
            var stats = GameStatsRepository.GetKickerStats(
                season: round.Season,
                playerName: player.Name);

            if (stats.Any())
            {
                var game = stats.First(s => s.Week == round.Week);
                var pat  = Min(
                    game.ExtraPointsMade,
                    TotalTdr + TotalTdc);
                var fgs = game.FieldGoalsMade;
                pts            = (fgs * 3) + pat;
                player.Points += pts;
            }
            return(pts);
        }
        public GameLog GameLogFor(
            string season,
            string playerName,
            string position    = "",
            bool sendToConsole = true)
        {
            if (!string.IsNullOrEmpty(position) && position == "KK")
            {
                position = "K";
            }
            var model = new PlayerReportModel
            {
                Season     = season,
                PlayerName = playerName,
                Position   = position
            };

            if (position == "K")
            {
                model.GameLog = _repo.GetKickerStats(model);
            }
            else
            {
                model.GameLog = _repo.GetGameStats(model);
            }

            if (sendToConsole)
            {
                _repo.SendToConsole(
                    model);
            }

            var gameLog = new GameLog
            {
                GameStatsList = model.GameLog
            };

            return(gameLog);
        }