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