/// <summary> /// Kiểu tra xem user với phiếu khuyến mãi có tồn tại chưa /// </summary> /// <param name="couponID"></param> /// <param name="phone"></param> /// <returns></returns> public bool existCustomerCoupon(int couponID, string phone) { using (var con = new inventorymanagementEntities()) { var customerCoupon = con.CustomerCoupons .Where(x => x.CouponID == couponID) .Where(x => x.Phone == phone) .FirstOrDefault(); return(customerCoupon != null); } }
/// <summary> /// Lấy các phiểu khuyển mãi của user còn hiệu lục /// </summary> /// <param name="phone"></param> /// <returns></returns> public List <CustomerCoupon> getCustomerCoupon(string phone) { using (var con = new inventorymanagementEntities()) { var coupons = con.CustomerCoupons .Where(x => x.Phone == phone) .Where(x => x.Active == true) .OrderBy(o => o.EndDate) .ToList(); return(coupons); } }