Example #1
0
        public async Task <IActionResult> Index()
        {
            var allCoupons = await _couponService.GetAllAvailableCouponsAsync();

            ViewData["coupons"] = allCoupons;

            return(View(allCoupons));
        }
        public async Task <ActionResult <List <CouponData> > > GetAllAvailableCouponAsync()
        {
            _logger.LogInformation("----- Get all available coupons");

            var response = await _coupon.GetAllAvailableCouponsAsync();

            var couponResponse = await response.Content.ReadAsStringAsync();

            var data = JsonConvert.DeserializeObject <List <CouponData> >(couponResponse);

            return(Ok(data));
        }