public ChartFilteringDTO FilteringByAttributes() { List <Supplier> suppliers = (List <Supplier>)supplierRepo.FindAll(); List <Stationery> stationeries = (List <Stationery>)stationeryRepo.FindAll(); List <Category> categories = (List <Category>)categoryRepo.FindAll(); List <Department> departments = (List <Department>)departmentRepo.FindAll(); ChartFilteringDTO FilteringDetails = new ChartFilteringDTO() { SupplierForChartList = suppliers, StationeryForChartList = stationeries, CategoryForChartList = categories, DepartmentForChartList = departments, }; return(FilteringDetails); }
public List <Department> retrieveAllDepartmentsWithApprovedRequisitions() { List <Department> departmentList = (List <Department>)departmentRepo.FindAll(); List <Employee> employeesAllDepartments = RetrieveAllEmployeesInAssignedDepartmentList(departmentList); List <Requisition> approvedRequisitionsFromEmployeesInAssignedDepartments = RetrieveAllApprovedRequisitionsByEmployeeList(employeesAllDepartments); List <Employee> distinctEmployeeId = new List <Employee>(); foreach (Requisition req in approvedRequisitionsFromEmployeesInAssignedDepartments.GroupBy(x => x.EmployeeId).Select(g => g.First()).Distinct().ToList()) { Employee outputEmployee = employeeRepo.FindById(req.EmployeeId); distinctEmployeeId.Add(outputEmployee); } List <Department> distinctDepartmentList = new List <Department>(); foreach (Employee x in distinctEmployeeId.GroupBy(x => x.DepartmentId).Select(g => g.First()).Distinct().ToList()) { Department outputDepartment = departmentRepo.FindById(x.DepartmentId); distinctDepartmentList.Add(outputDepartment); } return(distinctDepartmentList); }