/// <summary> /// Edit a season by passing the index of the season /// /// return an error if the season doesn't 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 doesn't exist</exception> /// <returns>Updated Dictionary of Seasons</returns> public Dictionary <int, Season> EditSeason(int index, Season season) { checkSeasonNumberIndex(season.SeasonNumber, index); if (!ListSeasons.ContainsKey(index)) { throw new SerieException(SerieEnum.NOTEXIST); } ListSeasons[index] = season; return(ListSeasons); }
/// <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); }