public int CreateNewSeason(int numberOfGames, DateTime startDate, DateTime? endDate) { var season = new Season { StartDate = startDate, EndDate = endDate, NumberOfWeeks = numberOfGames }; _seasonRepository.Save(season); return season.SeasonId; }
public ViewSeasonViewModel(Season season) { NumberOfWeeks = season.NumberOfWeeks; Weeks = new List<Week>(); for (int i = 0; i < NumberOfWeeks; i++) { if (season.Weeks.ElementAtOrDefault(i) != null) Weeks.Add(new Week(season.Weeks.ElementAt(i))); } NewWeek = new Week(); }