Пример #1
0
 private MLBYearByYearPitchingStatsViewModel ConvertDTOToViewModel(MLBYearByYearPitchingStatsDTO seasonStat)
 {
     return(new MLBYearByYearPitchingStatsViewModel
     {
         WHIP = Convert.ToDecimal(seasonStat.WHIP),
         Year = seasonStat.Year
     });
 }
Пример #2
0
        public MLBYearByYearPitchingStatsViewModel GetLeaguePitchingStatsByYear(int season)
        {
            if (season > 2019)
            {
                season = 2019;//TODO - TAKE THIS OUT .. it was just because their site was down
            }
            // return new MLBYearByYearPitchingStatsViewModel();

            MLBYearByYearPitchingStatsDTO seasonStat = MLBStatsApplicationService.MLBYearByYearPitchingStatsCache.FirstOrDefault(x => x.Year == season);

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

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