Exemple #1
0
        public IActionResult Create([FromBody] JsonDocument document)
        {
            _logger.Log(LogLevel.Trace, "A new transaction will be created");

            var transaction = JsonSerializer.Deserialize <TransactionModel>(document.ToString());

            var result = _transactionsManager.CreateOne(transaction);

            if (result == null)
            {
                _logger.Log(LogLevel.Error, "Couldn't create the transaction");
                return(NotFound());
            }

            _logger.Log(LogLevel.Information, "Transaction created successfully");
            return(Ok(result));
        }