예제 #1
0
        public void Redeem(PromotionRecipient recipient)
        {
            if (!this.CanRedeem(recipient))
            {
                throw new InvalidOperationException();
            }

            _recipients.Add(recipient);

            this.AddDomainEvent(new PromotionRedeemedDomainEvent(recipient.User.Id, Id, CurrencyType, Amount));
        }
예제 #2
0
 private bool CanRedeem(PromotionRecipient recipient)
 {
     return(this.IsActive() && !this.IsRedeemBy(recipient));
 }
예제 #3
0
 public bool IsRedeemBy(PromotionRecipient recipient)
 {
     return(Recipients.Any(x => x.User.Id == recipient.User.Id));
 }