Exemplo n.º 1
0
        public void AddDivision(SeasonDivision division)
        {
            division.Season = this;

            if (division.GetTeamsThatBelongToDivision() != null)
            {
                division.GetTeamsThatBelongToDivision().ToList().ForEach(t =>
                {
                    if (Teams.Where(team => team.Parent.Id == t.Parent.Id).FirstOrDefault() == null)
                    {
                        AddTeam(t);
                    }
                });
            }

            if (Divisions.Where(d => d.Name.Equals(division.Name)).FirstOrDefault() == null)
            {
                Divisions.Add(division);

                division.Children.ToList().ForEach(cd =>
                {
                    AddDivision(cd);
                });
            }
            else
            {
                //throw new SeasonException("Division was already added. " + division.Name);
            }
        }
Exemplo n.º 2
0
        public IList <Standings> GetStandingsByDivisionLevel(DivisionLevel level)
        {
            var result = new List <Standings>();

            Divisions.Where(d => d.Level == level).ToList().ForEach(ds =>
            {
                result.Add(GetStandingsByDivision(ds));
            });

            return(result);
        }
Exemplo n.º 3
0
        // get all divisions in a conference and sort them

        public List <Division> GetConferenceDivisions(string ConferenceId)
        {
            return(Divisions.Where(d => d.ConferenceId.Equals(ConferenceId)).OrderBy(d => d.Name).ToList());
        }