public void RemoveInterested(Event @event) { if (!Interests.Any(ui => ui.EventId == @event.EventId)) { throw new Exception("Event not in 'Interested'"); } else { UserInterested userInterested = Interests.SingleOrDefault(ui => ui.EventId == @event.EventId); Interests.Remove(userInterested); } }
public void AddGoing(Event @event) { if (Goings.Any(ug => ug.EventId == @event.EventId)) { throw new Exception("Event already in 'Going'"); } else if (Interests.Any(ui => ui.EventId == @event.EventId)) { UserInterested userInterested = Interests.SingleOrDefault(ui => ui.EventId == @event.EventId); Interests.Remove(userInterested); UserGoing userGoing = new UserGoing(this, @event); Goings.Add(userGoing); } else { UserGoing userGoing = new UserGoing(this, @event); Goings.Add(userGoing); } }