static void Main(string[] args) { try { stopwatch.Start(); IHttpService httpService = new HttpService(null, new BookingComRequestBuilder()); IBookingComService bookingComService = new BookingComService(httpService); var paramModel = new BookingParamModel(hotelName, checkin_monthday, checkin_month, checkin_year, checkout_monthday, checkout_month, checkout_year, room1, no_rooms, group_adults, group_children); var metaModel = new BookingComMetaModel { hotelId = hotelId, endpoint = endpoint, searchUrl = searchUrl, ParamModel = paramModel }; var r = bookingComService.GetHotelHTMLAsync(metaModel).Result; stopwatch.Stop(); Console.WriteLine("Time elapsed: {0:hh\\:mm\\:ss}", stopwatch.Elapsed); if (!string.IsNullOrEmpty(r.PriceData)) { PostProcess(r.PriceData); } } catch (Exception e) { Console.WriteLine(e.ToString()); } Console.ReadLine(); }
//example of json becing sent in //contenttype is application/json // { // "endpoint":"http://booking.com", // "searchUrl": "http://www.booking.com/searchresults.en-gb.html", // "hotelId": 1368239, // "ParamModel": // { // "ss":"Rozmalas", // "checkin_monthday":24, // "checkin_month":9, // "checkin_year":2016, // "checkout_monthday":25, // "checkout_month":9, // "checkout_year":2016, // "room1":"A,A", // "no_rooms":1, // "group_adults":2, // "group_children":0, // "ss_raw":"Rozmalas" // } //} // POST api/values public async Task <IHttpActionResult> Post(BookingComMetaModel metaModel) { var res = new ResponseEntity(); try { IHttpService httpService = new HttpService(null, new BookingComRequestBuilder()); IBookingComService bookingComService = new BookingComService(httpService); res.data = await bookingComService.GetHotelHTMLAsync(metaModel); } catch (Exception e) { res.error = e.ToString(); } return(Ok(res)); }