public IActionResult CreateWorkFlow(int patientId, string userName, string wfName) { WorkFlow workFlow = new WorkFlow(); var patientFound = _patientInfoRepository.GetPatient(patientId, false); if (patientFound == null) { return(NotFound()); } workFlow.Patient = patientFound; var userFound = _patientInfoRepository.GetUserByName(userName); if (userFound == null) { return(NotFound()); } workFlow.Username = userFound.Username; workFlow.WorkFlowName = wfName; int?workflowID = _patientInfoRepository.CreateWorkFlow(workFlow); if (workflowID == null) { return(NotFound()); } var workflowResult = Mapper.Map <WorkFlowDTO>(workFlow); return(Ok(workflowResult)); }