Ejemplo n.º 1
0
        public async Task <Unit> Handle(AddInterestsToAccount command, CancellationToken token = default)
        {
            await _repository.UpdateAsync(
                new AccountId(command.AccountId),
                account => account.AddInterests(),
                token);

            return(Unit.Value);
        }
        public async Task <IActionResult> AddInterests(
            [FromHeader(Name = Headers.RequestId)] Guid requestId, Guid id, CancellationToken token)
        {
            RequestContext.RequestId     = requestId;
            RequestContext.CausationId   = requestId;
            RequestContext.CorrelationId = requestId;

            var command = new AddInterestsToAccount(id);
            await _mediator.Send(command, token);

            return(Ok());
        }