public void SaveFolders(Domain.FolderSet folderSet) { var all = Folders.AsQueryable().First(); all.SelectedAnalyticFolders = folderSet.SelectedAnalyticFolders; all.SelectedEverydayFolders = folderSet.SelectedEverydayFolders; all.SelectedKitFolders = all.SelectedKitFolders; all.SelectedPromotionFolders = all.SelectedPromotionFolders; Folders.Save(all); }
public AdminModuleViewModel() { _repo = MainViewModel.SearchRepo; EventManager.GetEvent <SectionSelectionEvent>() .Subscribe(evt => { this.Navigate(evt.Section); }); //EventManager.GetEvent<FoldersSelectedVM>() // .Subscribe(vm => // { // }); EventManager.GetEvent <FolderSettingsUpdatedEvent>() .Subscribe(evt => { var vm = ((FolderSettingsViewModel)(SelectedSectionViewModel)); try { var folderSet = new Domain.FolderSet { SelectedAnalyticFolders = vm.AnalyticFolderSet, SelectedEverydayFolders = vm.EverydayFolderSet, SelectedPromotionFolders = vm.PromoFolderSet, SelectedKitFolders = vm.KitFolderSet }; _repo.SaveFolders(folderSet); } catch (Exception) { throw; } //if saved update in memory so search screen is updated //var mainFolderSet = ((HomeSearchViewModel)MainViewModel.SubModuleCache[Domain.SubModuleType.Search]); //mainFolderSet.FolderSet.SelectedAnalyticFolders = vm.AnalyticFolderSet; //mainFolderSet.FolderSet.SelectedEverydayFolders = vm.EverydayFolderSet; //mainFolderSet.FolderSet.SelectedPromotionFolders = vm.PromoFolderSet; //mainFolderSet.FolderSet.SelectedKitFolders = vm.KitFolderSet; //EventManager.Publish<NavigateEvent>( // new NavigateEvent // { // Module = Domain.ModuleType.Planning, // SubModule = Domain.SubModuleType.Search, // Section = Domain.SectionType.PlanningHomeMyHomePage // }); }); }