Пример #1
0
        public async Task <IActionResult> Delete(Coupon coupon)
        {
            if (coupon == null)
            {
                return(NotFound());
            }

            //work with the file
            //Delete the orignal file
            await _couponService.DeleteAsync(coupon);

            return(RedirectToAction(nameof(Index)));
        }
Пример #2
0
        public async Task <PaymentGatewayResult <IPaymentCoupon> > DeleteCouponAsync(string id)
        {
            try
            {
                var coupon = await _couponService.GetAsync(id);

                if (coupon == null)
                {
                    throw new Exception("Coupon not found");
                }
                coupon = await _couponService.DeleteAsync(id);

                return(PaymentGatewayResult <IPaymentCoupon> .Success(_mapper.Map <IPaymentCoupon>(coupon)));
            }
            catch (StripeException e)
            {
                return(PaymentGatewayResult <IPaymentCoupon> .Failed(e));
            }
        }