Exemple #1
0
        public async Task <ListAdvertisingCarouselDTO> GetHomeCarousel()
        {
            ListAdvertisingCarouselDTO lstCarousel = new ListAdvertisingCarouselDTO();
            string apiUrl   = "/api/v1/Advertising/GetCarouselList";
            var    response = await _client.GetAsync(apiUrl);

            if (response.IsSuccessStatusCode)
            {
                string responseStream = await response.Content.ReadAsStringAsync();

                lstCarousel = JsonConvert.DeserializeObject <ListAdvertisingCarouselDTO>(responseStream);
            }
            return(lstCarousel);
        }
Exemple #2
0
        /// <summary>
        /// Get Home Carousel
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> GetHomeCarousel()
        {
            ListAdvertisingCarouselDTO lstCarousel = new ListAdvertisingCarouselDTO();

            try
            {
                lstCarousel = await _repoWrapper.Advertising.GetHomeCarousel();
            }
            catch (Exception ex)
            {
                _logger.LogError($"HomeController- GetHomeCarousel {ex.ToString()}");
            }

            return(PartialView("HomeBanner", lstCarousel));
        }
        public async Task <ListAdvertisingCarouselDTO> GetCarouselList()
        {
            var output = new ListAdvertisingCarouselDTO();
            //var cacheKey = "Advertising_GetCarouselList";
            //var redisEncode = await _distributedCache.GetStringAsync(cacheKey);
            //if (redisEncode != null)
            //{
            //    output = JsonConvert.DeserializeObject<ListAdvertisingCarouselDTO>(redisEncode);
            //}
            //else
            //{
            var result = await _repoWrapper.Advertising.GetCarouselList();

            output.Data = _mapper.Map <IEnumerable <AdvertisingCarouselDTO> >(result);
            //    await _distributedCache.SetStringAsync(cacheKey, JsonConvert.SerializeObject(output), Utils.Util.RedisOptions());
            //}
            return(output);
        }