Пример #1
0
 private MLBYearByYearBattingStatsViewModel ConvertDTOToViewModel(MLBYearByYearBattingStatsDTO seasonStat)
 {
     return(new MLBYearByYearBattingStatsViewModel
     {
         OBP = Convert.ToDecimal(seasonStat.OBP),
         SLG = Convert.ToDecimal(seasonStat.SLG),
         Year = seasonStat.Year
     });
 }
Пример #2
0
        public MLBYearByYearBattingStatsViewModel GetLeagueBattingStatsByYear(int season)
        {
            if (season > 2019)
            {
                season = 2019;//TODO - TAKE THIS OUT .. it was just because their site was down
            }
            MLBYearByYearBattingStatsDTO seasonStat = MLBStatsApplicationService.MLBYearByYearBattingStatsCache.FirstOrDefault(x => x.Year == season);

            if (seasonStat != null)
            {
                return(this.ConvertDTOToViewModel(seasonStat));
            }

            throw new System.Exception("Unable to load MLB Hitting Stats for season " + season);
        }