public void addParticipations(Participation participation) { if (!checkIfParticipationExist(participation)) { meetingEntities.Participations.Add(participation); meetingEntities.SaveChanges(); } }
public void removeParticipations(Participation participation) { if (checkIfParticipationExist(participation)) { meetingEntities.Participations.Remove(participation); meetingEntities.SaveChanges(); } }
private bool checkIfParticipationExist(Participation participation) { return(meetingEntities.Participations.Where(p => p.MeetingName.Equals(participation.MeetingName) && p.UserLogin.Equals(participation.UserLogin)).DefaultIfEmpty(null).Single() != null); }