Exemple #1
0
        private async Task <bool> PostItToTheRightBucket(ReservationModel reservation, string bucket)
        {
            var reservationJson = JsonSerializer.Serialize(reservation);
            var content         = new StringContent(reservationJson);

            content.Headers.ContentType = new MediaTypeHeaderValue("applciation/json");
            var response = await _client.PostAsync($"reservations/{bucket}", content);

            return(response.IsSuccessStatusCode);
        }
Exemple #2
0
        private async Task <bool> DoIt(ReservationModel reservation, string status)
        {
            var reservationJson = JsonSerializer.Serialize(reservation);
            var content         = new StringContent(reservationJson);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var response = await Client.PostAsync($"/reservations/{status}", content);

            return(response.IsSuccessStatusCode);
        }
Exemple #3
0
 public async Task <bool> MarkReservationReady(ReservationModel reservation) //Ready
 {
     return(await PostItToTheRightBucket(reservation, "ready"));
 }
Exemple #4
0
 public async Task <bool> MarkReservationDeined(ReservationModel reservation) //Denied
 {
     return(await PostItToTheRightBucket(reservation, "denied"));
 }
Exemple #5
0
 public async Task <bool> MarkReservationCancelled(ReservationModel reservation)
 {
     return(await DoIt(reservation, "cancelled"));
 }
Exemple #6
0
 public async Task <bool> MarkReservationApproved(ReservationModel reservation)
 {
     return(await DoIt(reservation, "approved"));
 }