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