Esempio n. 1
0
        public async Task <IList <HotelDto> > GetByLocation(string at)
        {
            if (string.IsNullOrWhiteSpace(at))
            {
                _logger.LogError("Coordinates are null");
                throw new ArgumentNullException("Coordinates are null");
            }

            var hotels = await _messanger.GetHotelsByLocation(at);

            var hotelsDbo = _mapper.Map <IEnumerable <Hotel> >(hotels.Results);

            if (hotelsDbo.Any())
            {
                await _repository.AddRangeHotels(hotelsDbo);
            }

            return(_mapper.Map <List <HotelDto> >(hotelsDbo));
        }