Ejemplo n.º 1
0
        public async Task <IActionResult> ApplyTransaction([FromRoute] Guid Id, [FromRoute] Guid TransactionId)
        {
            var command = new ApplyTransactionCommand()
            {
                ApplicationId = Id,
                TransactionId = TransactionId,
                UserId        = _userId
            };

            await applicationService.ApplyTransaction(command);

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task ApplyTransaction(ApplyTransactionCommand command)
        {
            var application = await GetApplication(command.ApplicationId);

            var transaction = await transactionRepository.GetAsync(command.TransactionId);

            if (transaction == null || command.TransactionId == Guid.Empty)
            {
                throw new AggregateIllegalLogicException("Invalid transaction Id");
            }

            application.ApplyTransaction(transaction, command.UserId);
            await applicationRepository.UpdateAsync(application);
        }