Example #1
0
        private void CountdownTimerStep(object sender, EventArgs e)
        {
            if (_time > 1)
            {
                _time--;
                this.lblCounter.Content = _time;
            }
            else
            {
                _countdownTimer.Stop();

                this.lblCounter.Content = "";

                webcam.Stop();
                bntReCapture.Visibility = Visibility.Visible;
                bntCapture.Visibility = Visibility.Hidden;


                BookingDTO bookingDTO = new BookingDTO();
                bookingDTO.activityId = _activityDTO.activityId;
                bookingDTO.userId = _userDTO.userId;

                //var client = new RestClient("http://dkmkl-fusion-7/bookit");
                //var request = new RestRequest("booking", Method.PUT);
                //request.AddBody(bookingDTO);
                //RestResponse<BookingDTO> response = client.Execute<BookingDTO>(request);

                var client = new RestClient("http://dkmkl-fusion-7/bookit");
                var request = new RestRequest("booking", Method.PUT);

                //request.XmlSerializer.Serialize(bookingDTO);

                // add parameters for all properties on an object
                request.AddBody(bookingDTO, "http://schemas.datacontract.org/2004/07/Bookit.DTO");
                
                // execute the request
                RestResponse response = client.Execute(request);
                var content = response.Content; // raw content as string

                lblBookingStatus.Content = content;

                //if (response.Data != null)
                //    lblBookingStatus.Content = "Booking oprettet";
                //else
                //    lblBookingStatus.Content = "PROBLEM VED BOOKING";
            }
                
        }
Example #2
0
        public BookingDTO Update(BookingDTO bookingDTO)
        {
            try
            {
                logger.Info("PUT /booking kaldt");
                
                if (bookingDTO == null)
                    return null;

                Booking booking = new Booking();
                booking.ActivityId = bookingDTO.activityId;
                booking.UserId = bookingDTO.userId;
                booking.Timestamp = DateTime.Now;

                _geekLabData.Bookings.Add(booking);
                _geekLabData.SaveChanges();

                return bookingDTO;
            }
            catch (Exception ex)
            {

                logger.Error("A problem occured with PUT /booking " + ex.Message);
                return null;
            }
        }