Beispiel #1
0
        public IActionResult PostFileToBuffer([FromForm] BankStatementFile bankStatementFile)
        {
            var parsingResult = _importTransactionsService.ImportTransactions(bankStatementFile);

            return(parsingResult switch
            {
                CommandSuccess <int> commandSuccess => StatusCode(StatusCodes.Status201Created,
                                                                  new BankStatementFileImportResult()
                {
                    NumberOfImportedTransactions = commandSuccess.Result
                }),
                InvalidInputResult <int> invalidInputResult => Problem(invalidInputResult.Reason, statusCode: StatusCodes.Status400BadRequest),
                _ => throw new ArgumentOutOfRangeException(nameof(parsingResult))
            });
Beispiel #2
0
        private void _bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _watch.Stop();

            if (e.Cancelled)
            {
                _status = CommandStatus.Aborted;
                CommandAborted?.Raise(this, new EventArgs());
            }
            else
            {
                if (e.Error != null)
                {
                    _status = CommandStatus.Error;
                    CommandFailed?.Raise(this, new ErrorEventArgs(e.Error));
                }
                else
                {
                    _status = CommandStatus.Success;
                    CommandSuccess?.Raise(this, new EventArgs());
                }
            }
        }
Beispiel #3
0
 public CommandSuccessResponse(CommandSuccess success)
 {
     Success = success;
 }