예제 #1
0
        public JsonResult Images(int id)
        {
            HotelInformationRequest request = new HotelInformationRequest
                {
                    HotelId = id,
                    Options = new List<Options>()
                        {
                            Options.HOTEL_IMAGES
                        }
                };

            HotelInformationResponse response = _expediaService.GetHotelInformation(request);

            if (response.EanWsError != null)
            {
                Error(response.EanWsError.PresentationMessage);
            }

            return Json(response.HotelImages.HotelImage, JsonRequestBehavior.AllowGet);
        }
 public abstract HotelInformationResponse GetHotelInformation(HotelInformationRequest hotelInformationRequest);
 /// <summary>
 /// Fiddler URL Dump
 /// 
 /// http://api.ean.com/ean-services/rs/hotel/v3/info?hotelId=164989&options=HOTEL_IMAGES&apiKey=ty7wujrv6jc2vbrm2cpnmear&cid=55505&minorRev=20&currencyCode=GBP&locale=en_GB&customerUserAgent=Mozilla%2F5.0%20%28Windows%20NT%206.2%3B%20WOW64%29%20AppleWebKit%2F537.17%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F24.0.1312.57%20Safari%2F537.17&customerSessionId=0ABAA843-0682-2391-3CC2-CF6F03393718&customerIpAddress=%3A%3A1
 /// </summary>
 /// <param name="hotelInformationRequest"></param>
 /// <returns></returns>
 public override HotelInformationResponse GetHotelInformation(HotelInformationRequest hotelInformationRequest)
 {
     string path = PathFor("HotelInformationResponse.json");
     string content = Regex.Replace(File.ReadAllText(path), "");
     JsonDeserializer jsonDeserializer = new JsonDeserializer() { RootElement = "HotelInformationResponse" };
     HotelInformationResponse hotelInformationResponse = jsonDeserializer.Deserialize<HotelInformationResponse>(new RestResponse() {Content = content});
     return hotelInformationResponse;
 }
예제 #4
0
        public ActionResult Information(int id, string name)
        {
            HotelInformationRequest request = new HotelInformationRequest
                {
                    Options = new List<Options>(),
                    HotelId = id
                };

            try
            {
                HotelInformationResponse response = _expediaService.GetHotelInformation(request);

                if (response.EanWsError != null)
                {
                    Error(response.EanWsError.PresentationMessage);
                }

                return View(response);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);

                Error("An error occured. Please try again later.");
            }

            return View();
        }