private IEnumerable <WasteContainer> GetSelectedContainersBelongingToDisposer(DisposerViewModel disposer) { var selectedContainerModels = FilteredContainers.Where(fc => fc.IsSelected) .Select(selectedContainer => selectedContainer.ContainerViewModel.Model); var containers = disposer.Containers.Where(selectedContainerModels.Contains) .ToArray(); return(containers); }
private IEnumerable <DisposerViewModel> GetDisposersFromSelectedContainers() { var selectedContainerModels = FilteredContainers.Where(fc => fc.IsSelected) .Select(selectedContainer => selectedContainer.ContainerViewModel.Model); var disposers = m_Disposers.Where(d => d.Containers.Intersect(selectedContainerModels) .Any()) .Distinct() .ToArray(); return(disposers); }