public IActionResult GetOperationStatus(Guid operationId)
 {
     return(this.InvokeService(() =>
     {
         Models.OperationStatus status = _operationsStore.GetOperationStatus(operationId);
         int statusCode = (int)(status.Status == Models.OperationState.Succeeded ? StatusCodes.Status201Created : StatusCodes.Status200OK);
         return this.StatusCode(statusCode, status);
     }, _logger));
 }
Esempio n. 2
0
        private void CommitTransactions(Guid transactionId, Models.OperationStatus operationStatusExpected, Func <object, Models.Operation> commitAction)
        {
            var operations = _accountService.FindOperations(transactionId);

            operations.ValidateOperations();

            operations.ForEach(operation =>
            {
                var operationCommited = commitAction(operation.Id);
                if (operationCommited.Status != operationStatusExpected)
                {
                    throw new OperationNotRevertedException();
                }
            });
        }