private int GetSeasonYearsId(string seasonYears) { var seasonYearsRepo = new SeasonYearsRepository(); int existingYears = seasonYearsRepo.GetSeasonYearsBySeasonString(seasonYears); if (existingYears == 0) { var seasonYear = new SeasonYear(); seasonYear.Years = seasonYears; seasonYearsRepo.Save(seasonYear); existingYears = seasonYear.SeasonYearsId; } return existingYears; }
private void FixupSeasonYear(SeasonYear previousValue) { if (previousValue != null && previousValue.Seasons.Contains(this)) { previousValue.Seasons.Remove(this); } if (SeasonYear != null) { if (!SeasonYear.Seasons.Contains(this)) { SeasonYear.Seasons.Add(this); } if (SeasonYearsId != SeasonYear.SeasonYearsId) { SeasonYearsId = SeasonYear.SeasonYearsId; } } }