Ejemplo n.º 1
0
        /// <summary>
        /// Add a season (to the end) to the list with correct season number
        /// update number of seasons
        ///
        /// error if the season number doesn't match the id in the Dicionnary
        /// </summary>
        /// <param name="season"></param>
        /// <exception cref="Exception">Season number and key doesn't match</exception>
        /// <returns>Updated Dictionary of Seasons</returns>
        public Dictionary <int, Season> AddSeason(Season season)
        {
            checkSeasonNumberIndex(season.SeasonNumber, NumberSeasons + 1);

            ListSeasons.Add(season.SeasonNumber, season);
            NumberSeasons += 1;
            return(ListSeasons);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Surcharge AddSeason allowing to add a season with the episode number wanted
        ///
        /// return an error if the key already exist
        /// error if the season number doesn't match the id in the Dicionnary
        /// </summary>
        /// <param name="index"></param>
        /// <param name="season"></param>
        /// <exception cref="Exception">Season number and key doesn't match</exception>
        /// <exception cref="Exception">The season already exist</exception>
        /// <returns>Updated Dictionary of Seasons</returns>
        public Dictionary <int, Season> AddSeason(int index, Season season)
        {
            checkSeasonNumberIndex(season.SeasonNumber, index);

            if (ListSeasons.ContainsKey(index))
            {
                throw new SerieException(SerieEnum.EXIST);
            }
            ListSeasons.Add(index, season);
            NumberSeasons += 1;
            return(ListSeasons);
        }