Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
 private bool CanRedeem(PromotionRecipient recipient)
 {
     return(this.IsActive() && !this.IsRedeemBy(recipient));
 }
Ejemplo n.º 3
0
 public bool IsRedeemBy(PromotionRecipient recipient)
 {
     return(Recipients.Any(x => x.User.Id == recipient.User.Id));
 }