/// <summary> /// Create an edit form for an exsting MeetingReservation /// </summary> /// <param name="reservation">Edited MeetingReservation</param> public ReservationForm(Models.Entities.MeetingReservation reservation) { this.Reservation = reservation.GetEditForm(); this.DataContext = this; this.ReactiveWindowTitle = "Edit Reservation"; InitializeComponent(); }
private void CommitFormAction(object sender, EventArgs e) { Forms.ReservationForm form = sender as Forms.ReservationForm; switch (form.ClosedWith) { case Forms.CloseAction.Save: Models.Entities.MeetingReservation reservation = form.Reservation.Save(); if (!form.Reservation.Room.Reservations.ContainsKey(form.Reservation.Date.ToShortDateString()) || !form.Reservation.Room.Reservations[form.Reservation.Date.ToShortDateString()].Contains(reservation)) { form.Reservation.Room.AddReservation(reservation); } ViewModel.RefreshReservations(); break; case Forms.CloseAction.Delete: this.DeleteReservation(sender, null); ViewModel.RefreshReservations(); break; } }