private IEnumerable <ZonesViewModel> BindZoneViewModel(IEnumerable <AdminUnit> zones) { var zoneViewModels = new List <ZonesViewModel>(); foreach (var zone in zones) { var zoneViewModel = new ZonesViewModel(); zoneViewModel.AdminUnitID = zone.AdminUnitID; zoneViewModel.Zone = zone.Name; foreach (var woreda in zone.AdminUnit1) { var woredaViewModel = new WoredaViewModel { Woreda = woreda.Name, AdminUnitID = woreda.AdminUnitID }; var woreda1 = woreda; var fdpsInWoreda = _fdpService.Get(t => t.AdminUnitID == woreda1.AdminUnitID, null, "AdminUnit").ToList(); woredaViewModel.FDPs = BindFDPViewModel(fdpsInWoreda); zoneViewModel.Woredas.Add(woredaViewModel); } zoneViewModels.Add(zoneViewModel); } return(zoneViewModels); }
private IEnumerable<ZonesViewModel> BindZoneViewModel(IEnumerable<AdminUnit> zones) { var zoneViewModels = new List<ZonesViewModel>(); foreach (var zone in zones) { var zoneViewModel = new ZonesViewModel(); zoneViewModel.AdminUnitID = zone.AdminUnitID; zoneViewModel.Zone = zone.Name; foreach (var woreda in zone.AdminUnit1) { var woredaViewModel = new WoredaViewModel {Woreda = woreda.Name, AdminUnitID = woreda.AdminUnitID}; var woreda1 = woreda; var fdpsInWoreda = _fdpService.Get(t => t.AdminUnitID == woreda1.AdminUnitID, null, "AdminUnit").ToList(); woredaViewModel.FDPs = BindFDPViewModel(fdpsInWoreda); zoneViewModel.Woredas.Add(woredaViewModel); } zoneViewModels.Add(zoneViewModel); } return zoneViewModels; }