Ejemplo n.º 1
0
 private void FixupEmployeeTerritories()
 {
     foreach (var employeeTerritory in EmployeeTerritories)
     {
         employeeTerritory.Employee  = Employees.SingleOrDefault(e => e.EmployeeId == employeeTerritory.EmployeeId);
         employeeTerritory.Territory = Territories.SingleOrDefault(t => t.TerritoryId == employeeTerritory.TerritoryId);
     }
     foreach (var territory in Territories)
     {
         var empTerritories = EmployeeTerritories.Where(et => et.TerritoryId == territory.TerritoryId);
         territory.EmployeeTerritories.AddRange(empTerritories);
     }
 }