public IActionResult Add([FromBody] Department department) { try { return(Ok(_departmentData.Add(department))); } catch (Exception ex) { return(Problem(ex.Message, nameof(GetAll), StatusCodes.Status500InternalServerError, "Fail adding the department.")); } }