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)); }
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(); } }); }