コード例 #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"));
 }