public int Add(CouponModel model)
        {
            var coupon = new Coupon
            {
                CouponCode = model.CouponCode,
                Discount   = model.Discount
            };

            db.Coupons.Add(coupon);
            return(db.SaveChanges());
        }
        public int Update(CouponModel model)
        {
            var coupon = db.Coupons.FirstOrDefault(m => m.CouponId == model.CouponId);

            if (coupon != null)
            {
                coupon.CouponCode = model.CouponCode;
                coupon.Discount   = model.Discount;

                return(db.SaveChanges());
            }

            return(0);
        }