Esempio n. 1
0
        public OperationResult <HotelDetailsResponse> GetHotelDetails(HotelDetailsRequest req)
        {
            var client      = new RestClient("https://hotels-dev.mekongleisuretravel.com/ihs/v2/detail");
            var restRequest = InitRestRequest(req);
            var response    = client.Execute(restRequest);

            if (response.IsSuccessful)
            {
                if (response.ContentType.Contains("application/json"))
                {
                    var hotelDetailsResponse = _javaScriptScriptSerializer.Deserialize <HotelDetailsResponse>(response.Content);
                    return(new OperationResult <HotelDetailsResponse>(hotelDetailsResponse));
                }
            }

            return(new OperationResult <HotelDetailsResponse>(OperationResult.OperationStatus.GeneralError, response.ErrorMessage.ToString()));
        }
Esempio n. 2
0
        public ProxyResult <HotelDetailsResponse> GetHotelDetails(HotelDetailsRequest req)
        {
            var requestBody = new HotelDetailsRequest
            {
                ArrivalDate   = "12/29/2018",
                DepartureDate = "12/30/2018",
                RoomGuests    = new List <RoomGuestRequestModel>(),
                HotelId       = 632882
            };
            var roomGuest = new RoomGuestRequestModel();

            roomGuest.NumberOfAdults = 1;
            requestBody.RoomGuests.Add(roomGuest);

            var operationResult = _vleisureApiRequest.GetHotelDetails(requestBody);

            return(operationResult.ToProxyResult());
        }