void AddSeason() { SeasonViewModel season = new SeasonViewModel(); season.Changed += (o, ea) => IsChanged = true; season.Number = Seasons.Any() ? Seasons.Max(p => p.Number) + 1 : 1; Seasons.Add(season); SelectedSeason = season; }
public SerialViewModel(Serial serial) : base() { PrepareViewModel(); ID = serial.ID; RTitle = serial.RTitle; OTitle = serial.OTitle; Note = serial.Note; HasLastSeason = serial.HasLastSeason; CreateDate = serial.CreateDate; Description = serial.Description; KinopoiskId = serial.KinopoiskId; Rating = new RatingWithKinopoiskViewModel(0, serial.KinopoiskRating, serial.IMDBRating); foreach (var i in serial.Seasons) { var st = new SeasonViewModel(i); st.Changed += (o, ea) => IsChanged = true; Seasons.Add(st); } Rating.Changed += (o, ea) => IsChanged = true; IsChanged = false; }