public Achievement(Festival festival, Discipline discipline, Pupil pupil) { if (festival == null) { throw new ArgumentNullException(nameof(festival)); } if (discipline == null) { throw new ArgumentNullException(nameof(discipline)); } if (pupil == null) { throw new ArgumentNullException(nameof(pupil)); } Festival = festival; Discipline = discipline; Pupil = pupil; }
public static Achievement GetAchievement(SportsFestivalManagerContext connection, Festival festival, Discipline discipline, Pupil pupil) { var achievement = connection.Achievements.FirstOrDefault(x => x.FestivalId == festival.Id && x.DisciplineId == discipline.Id && x.PupilId == pupil.Id); if (achievement == null) { connection.Achievements.Add(achievement = new Achievement(festival, discipline, pupil)); } return(achievement); }