Ejemplo n.º 1
0
        public bool AddUserCoupon(int id, int userId)
        {
            if (id <= 0 || userId <= 0)
            {
                return(false);
            }

            using (var cxt = DbContext(DbOperation.Write))
            {
                cxt.BeginTransaction();

                var repo = new CouponRepo(cxt);
                var flag = repo.AddUserCoupon(id, userId);

                if (flag)
                {
                    cxt.Commit();
                }
                else
                {
                    cxt.Rollback();
                }

                return(flag);
            }
        }