public async Task Handle(OutgoingInvoicePaidEvent message) { using (var ctx = new AccountancyContext()) { var invoice = ctx.OutgoingInvoices .Where(i => i.OriginalId == message.InvoiceId) .Single(); invoice.IsPaid = true; invoice.PaymentDate = message.PaymentDate; await ctx.SaveChangesAsync(); } }
public void MarkAsPaid(DateTime paymentDate, Guid userId) { var evt = new OutgoingInvoicePaidEvent(this.Id, paymentDate, userId); RaiseEvent(evt); }
public void ApplyEvent([AggregateId(nameof(OutgoingInvoicePaidEvent.InvoiceId))] OutgoingInvoicePaidEvent evt) { PaymentDate = evt.PaymentDate; }