public IActionResult GetNewCode(string companyCode, UserType type) { try { string code = _employee.GetNewCode(companyCode, type); if (!String.IsNullOrEmpty(code)) { return(Ok(new { status = true, result = code })); } else { return(NotFound(new { status = false, result = "Failed to generate new code." })); } } catch (InvalidException err) { return(Ok(new { status = false, result = err.Message })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }