DisasterClusterCoordinatorsViewModel GetDisasterClusterCoordinatorsViewModel(Disaster disaster) { IList<Person> allPersonDataForDisplay; var clusterCoordinators = _clusterCoordinatorService.GetAllCoordinatorsForDisplay(disaster.Id, out allPersonDataForDisplay); var allClusters = _cluster.GetList().ToList(); var disasterClusterCoordinatorsViewModel = new DisasterClusterCoordinatorsViewModel { DisasterName = disaster.Name, DisasterId = disaster.Id, Clusters = allClusters .Select(c => new ClusterViewModel { Name = c.Name, Coordinators = clusterCoordinators .Where(x => x.ClusterId == c.Id) .Select(x => new ClusterCoordinatorViewModel { Name = x.Person.FullName, Id = x.Id, }) .ToList(), }) .ToList(), AvailableClusters = allClusters, AvailablePeople = allPersonDataForDisplay }; return disasterClusterCoordinatorsViewModel; }
DisasterClusterCoordinatorsViewModel GetDisasterClusterCoordinatorsViewModel(Disaster disaster) { var clusterCoordinators = _clusterCoordinatorService.GetAllCoordinators(disaster.Id); var disasterClusterCoordinatorsViewModel = new DisasterClusterCoordinatorsViewModel { DisasterName = disaster.Name, DisasterId = disaster.Id, Clusters = _cluster .GetList() .Select(c => new ClusterViewModel { Name = c.Name, Coordinators = clusterCoordinators .Where(x => x.ClusterId == c.Id) .Select(x => new ClusterCoordinatorViewModel { Name = x.Person.FullName, Id = x.Id, }) .ToList(), }) .ToList(), AvailableClusters = _cluster.GetList().ToList(), AvailablePeople = _dataService.Persons.ToList(), }; return disasterClusterCoordinatorsViewModel; }