public async Task <CheckinBooking> PutCheckinBooking(string bookingId, string cookieToken) { try { _logger.LogInformation("Started PutCheckinBooking"); var url = $"{Host}{PutBookingCheckin}"; var prismToken = GetPrismToken(cookieToken); Uri uri = new Uri(url.Replace("{booking-id}", bookingId)); HttpContent httpContent = new StringContent("{}", Encoding.UTF8, "application/json"); httpContent.Headers.Add("Cookie", cookieToken); httpContent.Headers.Add("Prism-Csrf", prismToken); _logger.LogInformation("PutCheckinBooking Request Initiated"); var result = await PutURI(uri, httpContent); _logger.LogInformation("PutCheckinBooking Request Ended"); if (result != Convert.ToString(HelperUtils.StatusType.ERROR)) { CheckinBooking _checkinBooking = Newtonsoft.Json.JsonConvert.DeserializeObject <CheckinBooking>(result); return(_checkinBooking); } throw new Exception("Invalid Booking Id or Booking already processed: " + bookingId); } catch (Exception ex) { _logger.LogError("PutCheckinBooking ===> " + ex.Message.ToString()); throw new Exception(ex.Message.ToString(), ex); } }
public async Task <IActionResult> CheckinPut(string bookingId) { try { _logger.LogInformation("Start: Fetching Cookie Token"); string cookieToken = await _authService.GetPadCookie(); _logger.LogInformation("Ended: Fetching Cookie Token"); _logger.LogInformation("Start: PutCheckinBooking"); CheckinBooking checkingBooking = await _employeeService.PutCheckinBooking(bookingId, cookieToken); _logger.LogInformation("End: PutCheckinBooking"); return(Ok(checkingBooking)); } catch (Exception ex) { _logger.LogError("CheckinPut Error ==> " + ex.Message.ToString()); return(BadRequest(ex.Message.ToString())); } }