コード例 #1
0
        private void GetBookingByCarId()
        {
            OnPropertyChanging(nameof(Bookings));

            if (this.selectedCar == null)
            {
                return;
            }

            this.booking.Clear();
            List <Booking> bookings = BookingFetcher.GetBookingByCarId(this.selectedCar.Id, this.DbFactory);

            bookings.ForEach(x => {
                this.booking.Add(new BookingItem {
                    Id = x.BookingId, CustomerName = x.CustomerName, Car = this.selectedCar, StartDate = x.StartDate, EndDate = x.EndDate
                });
            });

            OnPropertyChanged(nameof(Bookings));
        }
コード例 #2
0
        public object SaveCurrentBooking()
        {
            if (this.CanSaveBooking)
            {
                if (this.IsNewBooking)
                {
                    BookingFetcher.SaveBooking(new Booking {
                        CustomerName = this.CurrentBooking.CustomerName, CarId = this.CurrentBooking.Car.Id, StartDate = this.CurrentBooking.StartDate, EndDate = this.CurrentBooking.EndDate
                    }, this.DbFactory);
                }
                else
                {
                    BookingFetcher.UpdateBooking(new Booking {
                        CustomerName = this.CurrentBooking.CustomerName, CarId = this.CurrentBooking.Car.Id, StartDate = this.CurrentBooking.StartDate, EndDate = this.CurrentBooking.EndDate
                    }, this.DbFactory);
                }

                GetBookingByCarId();
            }
            return(this.CurrentBooking);
        }
コード例 #3
0
 private void DeleteBooking()
 {
     BookingFetcher.DeleteBooking(this.currentBooking.Id, this.DbFactory);
 }