コード例 #1
0
 public async Task Handle(IncomingInvoicePaidEvent message)
 {
     using (var ctx = new AccountancyContext())
     {
         var invoice = ctx.IncomingInvoices
                       .Where(i => i.OriginalId == message.InvoiceId)
                       .Single();
         invoice.IsPaid      = true;
         invoice.PaymentDate = message.PaymentDate;
         await ctx.SaveChangesAsync();
     }
 }
コード例 #2
0
        public void MarkAsPaid(DateTime paymentDate)
        {
            var evt = new IncomingInvoicePaidEvent(this.Id, paymentDate);

            RaiseEvent(evt);
        }
コード例 #3
0
 public void ApplyEvent([AggregateId(nameof(IncomingInvoicePaidEvent.InvoiceId))] IncomingInvoicePaidEvent evt)
 {
     PaymentDate = evt.PaymentDate;
 }