public HttpResponseMessage GetAssignedProjectRoleList(int employee_id = 0, int project_id = 0, int reportingto_id = 0)//e_id employee_id , p_id project_id { HttpResponseMessage response = null; try { List <Project_role_model> project_role_list = ProjectRepo.GetAssignedProjectRoleList(employee_id, project_id, reportingto_id); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", project_role_list)); } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
[Route("api/v1/employee/project/list/{reporting_id?}")]//same as api/v1/project_role/list/{reportingto_id?} public HttpResponseMessage GetEmpProjDetailsByManager(int reporting_id) { HttpResponseMessage response = null; try { if (reporting_id != 0) { if (EmployeeRepo.GetEmployeeById(reporting_id) != null) { ArrayList emp_prj_list = new ArrayList(); List <EmployeeModel> Emp_List = EmployeeRepo.GetEmployeeList(reporting_id, 0); foreach (EmployeeModel items in Emp_List) { List <Project_role_model> proj_list = ProjectRepo.GetAssignedProjectRoleList(items.id, 0, 0); emp_prj_list.Add(proj_list); } // List<Project_role_model> proj_list = ProjectRepo.EmpProjDetailsByManager(manager_id); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", emp_prj_list)); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_403", "Invalid employee ID", "Invalid employee ID")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }