예제 #1
0
        public async Task <ActionResult> Index()
        {
            var coupons = await _couponRespository.GetByUser(User.Identity.Name);

            var model = new List <CouponPromoList>();

            if (coupons.Any())
            {
                foreach (var coupon in coupons.OrderByDescending(n => n.DateExpires))
                {
                    var promo = await _promoRepository.Get(coupon.PromoId.ToString());

                    model.Add(new CouponPromoList
                    {
                        Coupon = coupon,
                        Promo  = promo
                    });
                }
            }
            return(View(model));
        }