Beispiel #1
0
        public async Task <IActionResult> GetListingsAveragePriceFiltered(int neighbourhoodId)
        {
            var key       = $"AveragePriceFiltered-{neighbourhoodId}";
            var cacheItem = await _cache.Get(key);

            if (cacheItem != null)
            {
                return(Ok(cacheItem));
            }

            var response = Newtonsoft.Json.JsonConvert.SerializeObject(
                await ChartJson.CreatePrices(_listingsRepo.AllStats("prices", neighbourhoodId))
                );

            _cache.Set(key, response);

            return(Ok(response));
        }
Beispiel #2
0
        public async Task <IActionResult> GetListingsAveragePrice()
        {
            const string key       = "AveragePrice";
            var          cacheItem = await _cache.Get(key);

            if (cacheItem != null)
            {
                return(Ok(cacheItem));
            }

            var response = Newtonsoft.Json.JsonConvert.SerializeObject(
                await ChartJson.CreatePrices(_listingsRepo.AllStats("prices"))
                );

            _cache.Set(key, response);

            return(Ok(response));
        }