public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            List <string> names = new List <string>();

            Department department = await _departmentRepo.FindById(Department);

            if (department != null)
            {
                foreach (var user in _userManager.Users)
                {
                    if (user != null && _departmentRepo.UserIsInDepartment(user, department.Id))
                    {
                        names.Add(user.UserName);
                    }
                }
            }
            output.Content.SetContent(names.Count == 0 ? "No Users" : string.Join(" , ", names));
        }
Ejemplo n.º 2
0
        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);
        }