Пример #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);
        }
Пример #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);
        }
Пример #3
0
 public async Task <bool> MarkReservationReady(ReservationModel reservation) //Ready
 {
     return(await PostItToTheRightBucket(reservation, "ready"));
 }
Пример #4
0
 public async Task <bool> MarkReservationDeined(ReservationModel reservation) //Denied
 {
     return(await PostItToTheRightBucket(reservation, "denied"));
 }
Пример #5
0
 public async Task <bool> MarkReservationCancelled(ReservationModel reservation)
 {
     return(await DoIt(reservation, "cancelled"));
 }
Пример #6
0
 public async Task <bool> MarkReservationApproved(ReservationModel reservation)
 {
     return(await DoIt(reservation, "approved"));
 }