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); }
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; }