private TeamResultsSummary GetTeamResultsByTeamName(string team) { TeamResultsSummary resultsSummary = teamsResults.Find(tr => tr.Team == team); if (resultsSummary == null) { resultsSummary = new TeamResultsSummary(); resultsSummary.Team = team; teamsResults.Add(resultsSummary); }; return resultsSummary; }
public void AddPointsAndGoals(FootballMatch match, TeamResultsSummary hostResults, TeamResultsSummary guestResults) { if (match.NumberOfGoalsScoredByHosts > match.NumberOfGoalsScoredByGuests) { hostResults.Points += NumerOfPointForWin; } else if (match.NumberOfGoalsScoredByHosts < match.NumberOfGoalsScoredByGuests) { guestResults.Points += NumerOfPointForWin; } else { hostResults.Points += NumerOfPointForDraw; guestResults.Points += NumerOfPointForDraw; } hostResults.GoalsScored += match.NumberOfGoalsScoredByHosts; hostResults.GoalsLost += match.NumberOfGoalsScoredByGuests; guestResults.GoalsScored += match.NumberOfGoalsScoredByGuests; guestResults.GoalsLost += match.NumberOfGoalsScoredByHosts; }