public IActionResult AddCommodity([FromBody] Commodity commodity) { try { _repo.AddCommodity(commodity); return(Ok()); } catch (Exception ex) { _logger.Write(LogEventLevel.Error, ex, "AddCommodity failed: {ex.message}"); var returnResult = ex.InnerException?.InnerException?.Message ?? ex.Message; return(BadRequest(returnResult)); } }