Пример #1
0
        private void OnUpdateReservationCommand()
        {
            if (ReservationData.Contains(this.Reservation))
            {
                ReservationWindow window = new ReservationWindow();

                Reservation currentReservation = new Reservation();

                currentReservation.Copy(Reservation);

                (window.DataContext as ReservationWindowViewModel).Reservation = currentReservation;

                bool?result = window.ShowDialog();

                if (result == true)
                {
                    reservation.Copy(currentReservation);
                }
            }
        }
Пример #2
0
        private void OnAddReservationCommand()
        {
            ReservationWindow window = new ReservationWindow();

            bool?result = window.ShowDialog();

            if (result == true)
            {
                Reservation reservation = (window.DataContext as ReservationWindowViewModel).Reservation;

                if (reservation != null)
                {
                    int maxId = 0;
                    if (ReservationData.Count != 0)
                    {
                        maxId = ReservationData.Select(x => x.Id).Max();
                    }
                    reservation.Id = maxId + 1;
                    ReservationData.Add(reservation);
                }
            }
        }