public static List <Coupon> GetAll(int storeId)
        {
            CouponQuery q = new CouponQuery();

            q.Where(q.StoreId == storeId);
            q.OrderBy(q.Code.Ascending);

            CouponCollection collection = new CouponCollection();

            collection.Load(q);

            return(collection.ToList());
        }
Exemple #2
0
        public static Coupon GetCoupon(string couponCode, int storeId)
        {
            CouponQuery q = new CouponQuery();

            q.es.Top = 1;
            q.Where(q.StoreId == storeId, q.Code.ToUpper() == couponCode.ToUpper());

            Coupon coupon = new Coupon();

            if (coupon.Load(q))
            {
                return(coupon);
            }
            return(null);
        }