Example #1
0
        public async Task <ActionResult> Index(string promoId)
        {
            ViewBag.ShowSuccess = false;
            ViewBag.Quantity    = 1;
            var promo = await _promoRepository.Get(promoId);

            ViewBag.Total = ViewBag.Quantity * promo.Price;

            var gateway     = CreateBrainTreeGateway();
            var clientToken = gateway.ClientToken.Generate();

            ViewBag.ClientToken = clientToken;

            return(View(promo));
        }
Example #2
0
        public async Task <JsonResult> GetCoupon(string qrcode)
        {
            var response = new ResponseGetQRCode();
            var coupon   = await _couponRespository.Get(qrcode);

            response.Coupon = coupon;
            if (coupon != null)
            {
                var user = await _userRepository.GetUser(coupon.User);

                response.User = user;
                var promo = await _promoRepository.Get(coupon.PromoId.ToString());

                response.Promo = promo;
            }

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public async Task <ActionResult> Redeem(string couponId)
        {
            var coupon = await _couponRespository.Get(couponId);

            var promo = await _promoRepository.Get(coupon.PromoId.ToString());

            var model = new CouponPromoList
            {
                Promo  = promo,
                Coupon = coupon
            };

            return(View(model));
        }
Example #4
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));
        }
Example #5
0
        public async Task <ActionResult> Create(string id)
        {
            var model = new CreatePromoViewModel();

            if (!string.IsNullOrEmpty(id))
            {
                model.Promo = await _promoRepository.Get(id);
            }
            else
            {
                model.Promo = new Promo();
            }

            var orgService = new OrganisationService(_organisationRepository, _userRepository);

            model.Organisations = await orgService.Get(User.Identity.Name);

            var user = await _userRepository.GetUser(User.Identity.Name);

            model.IsAdministrator = user.IsAdmin;

            return(View(model));
        }
Example #6
0
        public async Task <ActionResult> Details(string promoId)
        {
            var promo = await _promoRepository.Get(promoId);

            return(View(promo));
        }