コード例 #1
0
        public async Task <HotelWithDetails> GetHotel(string travelIdentity)
        {
            var hotel = await HotelRepository.GetHotel(travelIdentity);

            if (hotel == null)
            {
                return(null);
            }
            var transportCategories = await HotelRepository.GetTransportCategories(hotel.HotelId);

            var transports = new List <HotelTransport>();

            foreach (var category in transportCategories)
            {
                var transport = await HotelRepository.GetTransport(hotel.HotelId, category.Category);

                var tr = new HotelTransport
                {
                    Category           = category.Category,
                    TransportLocations = transport.Select(t => HotelConverter.ToDomainTransportLocation(t)).ToArray()
                };
                transports.Add(tr);
            }

            return(new HotelWithDetails
            {
                Hotel = HotelConverter.ToDomainHotel(hotel),
                Transport = transports
            });
        }
コード例 #2
0
        public async Task <IEnumerable <Hotel> > GetHotels(string cityName)
        {
            var apiResponse = await HotelsApiClient.GetHotels(cityName);

            return(HotelConverter.ToDomainHotel(apiResponse));
        }