public bool AddReservation(Reservation obj)
 {
     return AddItem(obj);
 }
 public bool DeleteReservation(Reservation obj)
 {
     return DeleteItem(obj, obj.Id);
 }
 private void LoadReservationRefs(Reservation x)
 {
     if (!string.IsNullOrEmpty(x.CustomerId))
     {
         x.Customer = GetItem<Customer>(x.CustomerId);
     }
     if (!string.IsNullOrEmpty(x.GadgetId))
     {
         x.Gadget = GetItem<Gadget>(x.GadgetId);
     }
 }
 public bool UpdateReservation(Reservation obj)
 {
     return UpdateItem(obj, obj.Id);
 }
 private void addReservationButton_Click(object sender, RoutedEventArgs e)
 {
     if (customerDataGrid.SelectedItem == null)
         return;
     GadgetViewModel gadget = (GadgetViewModel)newReservationComboBox.SelectedItem;
     if (gadget == null)
     {
         MessageBox.Show("You must select a gadget!");
         return;
     }
     Reservation res = new Reservation
     {
         Id = GetNewReservationId(),
         CustomerId = _customerId,
         Finished = false,
         GadgetId = gadget.InventoryNumber,
         Gadget = gadget.GetGadget(),
         ReservationDate = DateTime.Now
     };
     res.WaitingPosition = GetWaitingPosition(res.Gadget);
     ReservationViewModel model = new ReservationViewModel(_service, res);
     ReservationList.Add(model);
     newReservationComboBox.SelectedIndex = -1;
     newReservationComboBox.ItemsSource = GetAvailableGadgetsForCustomer(_customerId);
 }
Example #6
0
        public bool DeleteReservationForCustomer(Reservation reservation)
        {
            CheckToken();

            var parameter = PrepareDictionaryWithToken();
            parameter.Add("id", reservation.Id);

            return CallRestApi<bool>("/public/reservations", Method.DELETE, parameter);
        }
 public ReservationViewModel(LibraryAdminService service, Reservation reservation)
 {
     _service = service;
     _reservation = reservation;
 }