Exemple #1
0
        public async Task Handle(ContractAmountUpdated @event, CancellationToken cancellationToken)
        {
            var e = await _contractReadModelRepository.GetByIdAsync(@event.ContractId, cancellationToken);

            //if(e == null)
            //    throw new Exception("Could not find entity in readModel");

            if (e != null)
            {
                e.Amount  = @event.NewAmount;
                e.Version = e.Version + 1;

                await _contractReadModelRepository.SaveChangesAsync(cancellationToken);
            }
        }
Exemple #2
0
 private void Apply(ContractAmountUpdated e)
 {
     this.Amount = e.NewAmount;
 }