Exemplo n.º 1
0
        public IEnumerable <domain.Hotel> GetHotelsByDestinationAndNights(int destination, int nights)
        {
            string url = $"{webBedsEndPoint}findBargain?destinationId={destination}&nights={nights}&code={webBedsSecretCode}";

            var result = _cache.Get <IEnumerable <domain.Hotel> >($"HotelsByDestinationAndNights[{destination}][{nights}]");

            if (result == null)
            {
                var resultDto = _webApiService.Get <List <HotelDto> >(url, 1000);

                result = Translate(resultDto, nights);

                if (result.Any())
                {
                    _cache.Set($"HotelsByDestinationAndNights[{destination}][{nights}]", result);
                }
            }

            return(result);
        }
        public IEnumerable <domain.City> All()
        {
            var result = _cache.Get <IEnumerable <domain.City> >($"All");

            if (result == null)
            {
                //http://partners.api.skyscanner.net/apiservices/geo/v1.0?apikey=prtl6749387986743898559646983194

                string url = $"{skyScannerEndPoint}/apiservices/geo/v1.0?apikey={skyScannerAPIKey}";

                var resultDto = _webApiService.Get <AirportDto>(url, 1000);

                result = Translate(resultDto);

                if (result.Any())
                {
                    _cache.Set($"All", result);
                }
            }

            return(result);
        }
Exemplo n.º 3
0
        public IEnumerable <Gif> GetGifsBySearchString(string searchString, int limit)
        {
            //https://api.giphy.com/v1/gifs/search?api_key=pfYnWHuFkkPIlRsXiC98aH4fsrWYWpnW&q=&limit=25&offset=0&rating=G&lang=en


            string url = $"{giphyEndPoint}/gifs/search?api_key={giphyAPIKey}&q={searchString}&limit={limit}&offset=0&rating=G&lang=en";

            var result = _cache.Get <IEnumerable <domain.Gif> >($"GifsBySearchStringAndLimit[{searchString}][{limit}]");

            if (result == null)
            {
                var resultDto = _webApiService.Get <ExternalGifDto>(url, 1000);

                result = Translate(resultDto);

                if (result.Any())
                {
                    _cache.Set($"GifsBySearchStringAndLimit[{searchString}][{limit}]", result);
                }
            }

            return(result);
        }
Exemplo n.º 4
0
 public ActionResult <List <Client> > Get() =>
 _webApiService.Get();