Created
April 24, 2017 02:55
-
-
Save ralhamami/b7c27a86fb93c67a7df5ea426842d2dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static List<string> GetEmployeePaths() | |
| { | |
| List<string> employeePaths = new List<string>(); | |
| allEmployees = GetAllEmployees(); | |
| foreach (Employee employee in allEmployees) | |
| { | |
| employeePaths.Add(RecursivePathFinder(employee)); | |
| } | |
| employeePaths.Sort(); | |
| return employeePaths; | |
| } | |
| private static string RecursivePathFinder(Employee employee) | |
| { | |
| if (employee.ParentEmployeeId == 0) | |
| { | |
| return employee.Name; | |
| } | |
| else | |
| { | |
| return RecursivePathFinder(allEmployees.Where(x => x.EmployeeId == employee.ParentEmployeeId).First()) + "/" + employee.Name; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment