Exemplo n.º 1
0
        public async Task <List <Hotel> > GetAllHotels()
        {
            var          request = new HotelsRequest(Guid.NewGuid());
            List <Hotel> hotels  = await DoRequest <List <Hotel> >(request);

            //берем только уникальные записи от всех провайдеров
            return(hotels.GetUniqueElements(h => h.Name));
        }
Exemplo n.º 2
0
        public async Task <HotelsResponse> GetHotels(string accessToken, HotelsRequest request)
        {
            AddBearerAuthorization(accessToken);

            const string uri      = "shopping/hotel-offers?cityCode=MUC";
            var          response = await GetAsync <HotelsResponse>(uri);

            return(response);
        }
Exemplo n.º 3
0
        public void Should_be_return_hotels_by_location()
        {
            var accessToken = _client.GetAuthentication().Result;
            var request     = new HotelsRequest {
                cityCode = "MUC"
            };

            var hotels = _client.GetHotels(accessToken, request).Result;

            Assert.IsNotNull(hotels.data);
        }
Exemplo n.º 4
0
        private async Task ReceiveHotelsRequest(HotelsRequest request)
        {
            var hotels = await _dictionariesRepository.GetAllHotels();

            _messageBusClient.SendMessage(new HotelsResponse(request.RequestId, nameof(OtherSearchService))
            {
                Data = hotels.Select(hotel => new Hotel
                {
                    Id           = hotel.Id,
                    Name         = hotel.Name,
                    CityName     = hotel.City.Name,
                    Address      = hotel.Address,
                    BuildingYear = hotel.BuildingYear
                }).ToList()
            });
        }
Exemplo n.º 5
0
        public static HotelOffers Process(HotelsRequest rentalCarsRequest)
        {
            var response = new SkyScannerProvider().GetHotels();

            return(SkyScannerCarsRSMapper.Map(response));
        }