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); }
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); }
public async Task <bool> MarkReservationReady(ReservationModel reservation) //Ready { return(await PostItToTheRightBucket(reservation, "ready")); }
public async Task <bool> MarkReservationDeined(ReservationModel reservation) //Denied { return(await PostItToTheRightBucket(reservation, "denied")); }
public async Task <bool> MarkReservationCancelled(ReservationModel reservation) { return(await DoIt(reservation, "cancelled")); }
public async Task <bool> MarkReservationApproved(ReservationModel reservation) { return(await DoIt(reservation, "approved")); }