public void AddTeamToDivision(SeasonDivision division, SeasonTeam team) { //first if the division if (!team.IsDivisionInList(division)) { team.AddDivisionToTeam(division); } if (!division.IsTeamInList(team)) { division.AddTeam(team); } }
public void AddTeam(SeasonTeam team) { if (!(Children.ToList().Where(d => d.IsTeamInDivision(team)).ToList().FirstOrDefault() == null)) { throw new SeasonException("Team : " + team.Name + " already belongs to a child division of " + Name); } if (Parent != null && Parent.IsTeamInDivision(team)) { throw new SeasonException("Team : " + team.Name + " belongs to the parent division - " + Parent.Name + " - " + Name); } team.AddDivisionToTeam(this); _Teams.Add(team); }
public SeasonRanking(SeasonTeam team, int rank, SeasonDivision division) { Team = team; Rank = rank; Division = division; }
//this could be child division public bool IsTeamInDivision(SeasonTeam team) { return(Teams.Where(t => t.Parent.Id == team.Parent.Id).FirstOrDefault() != null); }