Exemplo n.º 1
0
        private async void modifyButton_ClickAsync(object sender, EventArgs e)
        {
            string email = emailText.Text;


            string reserv = reservationList.SelectedItem.ToString();

            string[] ssize = reserv.Split(null);

            long id = Int64.Parse(ssize[1]);

            Debug.WriteLine(id);
            Reservation reservation = new Reservation();

            reservation.serviceType = (string)serviceList.SelectedItem;
            reservation.cabin       = (string)stugorList.SelectedItem;
            reservation.datum       = datum.Text;
            reservation.booker      = emailText.Text;


            RestApi api = new RestApi();
            await api.modifyReservation(reservation, id);

            List <Reservation> reservations = await api.getReservations(email);

            updateReservationListBox(reservations);
        }
Exemplo n.º 2
0
        private async void sendEmail_ClickAsync(object sender, EventArgs e)
        {
            string email = emailText.Text;

            RestApi      api    = new RestApi();
            List <Cabin> cabins = await api.getCabins(email);

            List <Service> services = await api.getServices();

            List <Reservation> reservations = await api.getReservations(email);

            updateCabinListBox(cabins);
            updateServiceListBox(services);
            updateReservationListBox(reservations);
        }
Exemplo n.º 3
0
        private async void deleteButton_ClickAsync(object sender, EventArgs e)
        {
            //splitta med mellanrum

            string email  = emailText.Text;
            string reserv = reservationList.SelectedItem.ToString();

            string[] ssize = reserv.Split(null);
            long     id    = Int64.Parse(ssize[1]);
            RestApi  api   = new RestApi();
            await api.deleteReservation(id);

            List <Reservation> reservations = await api.getReservations(email);

            updateReservationListBox(reservations);
        }
Exemplo n.º 4
0
        private async void bookButton_Click(object sender, EventArgs e)
        {
            string      email       = emailText.Text;
            Reservation reservation = new Reservation();

            reservation.ID          = 23;
            reservation.serviceType = (string)serviceList.SelectedItem;
            reservation.cabin       = (string)stugorList.SelectedItem;
            reservation.datum       = datum.Text;
            reservation.booker      = email;
            RestApi api = new RestApi();
            await api.saveReservation(reservation);

            List <Reservation> reservations = await api.getReservations(email);

            updateReservationListBox(reservations);
        }