public IHttpActionResult AddEmployee(Employee newEmp) { if (DBOperations.AddEmployee(newEmp, out string msg)) { if (DBOperations.AddUser(newEmp)) { if (newEmp.IsManager == "1") { var resultOfAddManagers = StoredProcsCall.AddManagers(newEmp.EmployeeId); if (!resultOfAddManagers) { return(Ok("Unable to add employee to managers table")); } } var resultOfLeaveAllocation = StoredProcsCall.AllocateLeave(newEmp.EmployeeId, newEmp.DOJ.Month); if (!resultOfLeaveAllocation) { return(Ok("Unable to set up leave allocation")); } if (!DBOperations.AddReportingAuthorities(newEmp.EmployeeId, newEmp.managerName)) { return(Ok("Unable to set Reporting Authority!")); } CompleteRegistration(newEmp); return(Ok("Associate has been added successfully!")); } else { return(Ok("Failed to add user")); } } else { return(Ok(msg)); } }