public DualTransactionCommand(
     IStorageStore storageStore,
     IEventStore eventStore,
     ITransactionValidationService transactionValidationService,
     DualTransactionData data)
 {
     this.storageStore = storageStore;
     this.eventStore   = eventStore;
     this.transactionValidationService = transactionValidationService;
     this.data = data;
 }
예제 #2
0
        public async Task <IActionResult> MoveItemAsync(DualTransactionData transaction)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var command = commandFactory.GetDualTransactionCommand(transaction);

            try
            {
                await command.ExecuteAsync();
            }
            catch (NotAuthorizedException)
            {
                return(Forbid());
            }
            catch (ValidationException)
            {
                return(BadRequest());
            }

            return(Ok());
        }
예제 #3
0
 public ICommand GetDualTransactionCommand(DualTransactionData data)
 {
     return(new DualTransactionCommand(storageStore, eventStore, transactionValidationService, data));
 }