private void CopyPlayerDataIfPlayerExists(Pitching pitching, PitchingStats pitchingStats) { if (pitching.Player != null) { pitchingStats.NameFirst = pitching.Player.NameFirst; pitchingStats.NameLast = pitching.Player.NameLast; pitchingStats.NameGiven = pitching.Player.NameGiven; } }
private void CopyNullableStats(Pitching pitching, PitchingStats pitchingStats) { pitchingStats.W = pitching.W; pitchingStats.L = pitching.L; pitchingStats.G = pitching.G; pitchingStats.Gs = pitching.Gs; pitchingStats.Cg = pitching.Cg; pitchingStats.Sho = pitching.Sho; pitchingStats.Sv = pitching.Sv; pitchingStats.Ipouts = pitching.Ipouts; pitchingStats.H = pitching.H; pitchingStats.Er = pitching.Er; pitchingStats.Hr = pitching.Hr; pitchingStats.Bb = pitching.Bb; pitchingStats.So = pitching.So; pitchingStats.Baopp = pitching.Baopp; pitchingStats.Era = pitching.Era; pitchingStats.Ibb = pitching.Ibb; pitchingStats.Wp = pitching.Wp; pitchingStats.Hbp = pitching.Hbp; pitchingStats.Bk = pitching.Bk; pitchingStats.Bfp = pitching.Bfp; pitchingStats.Gf = pitching.Gf; pitchingStats.R = pitching.R; pitchingStats.Sh = pitching.Sh; pitchingStats.Sf = pitching.Sf; pitchingStats.Gidp = pitching.Gidp; }
public PitchingStats Map(Pitching pitching) { var pitchingStats = new PitchingStats() { PlayerId = pitching.PlayerId, YearId = pitching.YearId, Stint = pitching.Stint, TeamId = pitching.TeamId, LgId = pitching.LgId, }; CopyPlayerDataIfPlayerExists(pitching, pitchingStats); CopyNullableStats(pitching, pitchingStats); _calculator.CalculateStats(pitchingStats); return(pitchingStats); }
public void CalculateStats(PitchingStats pitchingStats) { pitchingStats.Era = CalculateEra(pitchingStats.Era); pitchingStats.Baopp = CalculateBaopp(pitchingStats.Baopp); }