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(); } }
public void MarkAsPaid(DateTime paymentDate) { var evt = new IncomingInvoicePaidEvent(this.Id, paymentDate); RaiseEvent(evt); }
public void ApplyEvent([AggregateId(nameof(IncomingInvoicePaidEvent.InvoiceId))] IncomingInvoicePaidEvent evt) { PaymentDate = evt.PaymentDate; }