private void EnsureAttendeeIsAttendingThisConference(Attendee attendee) { if (!IsAttending(attendee)) { throw new NotAttendingConferenceException(attendee, this); } }
public void SignUpForSession(Attendee attendee, int sessionId) { EnsureAttendeeIsAttendingThisConference(attendee); var session = FindSession(sessionId); session.Attend(attendee); }
public void Attend(Attendee attendee) { EnsureSessionIsNotFull(); Attendees.Add(attendee); }
private bool IsAttending(Attendee attendee) { return Attendees.Contains(attendee); }
/// <summary> /// Create a new Attendee object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> public static Attendee CreateAttendee(global::System.Int32 id, global::System.String name) { Attendee attendee = new Attendee(); attendee.Id = id; attendee.Name = name; return attendee; }
/// <summary> /// Deprecated Method for adding a new object to the Attendees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAttendees(Attendee attendee) { base.AddObject("Attendees", attendee); }
public NotAttendingConferenceException(Attendee attendee, Conference conference) : base(attendee.Name + " is not registered for the conference " + conference.Name) { }