Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 2
0
        public void MarkAsPaid(DateTime paymentDate, Guid userId)
        {
            var evt = new OutgoingInvoicePaidEvent(this.Id, paymentDate, userId);

            RaiseEvent(evt);
        }
Exemplo n.º 3
0
 public void ApplyEvent([AggregateId(nameof(OutgoingInvoicePaidEvent.InvoiceId))] OutgoingInvoicePaidEvent evt)
 {
     PaymentDate = evt.PaymentDate;
 }