private void NavToSection() { SelectedSection = null; AddEditMode = false; Levels = new ObservableCollection <Level>(_levelsRepository.GetLevels()); if (Levels.Any()) { SelectedLevelId = SelectedLevelId; } AddEditSectionViewModel.Initialize(); AddEditSectionViewModel = addEditSectionViewModel; }
public SectionViewModel(ILevelsRepository levelsRepository, ISectionsRepository sectionsRepository, IStudentsRepository studentsRepository) { _levelsRepository = levelsRepository; _sectionsRepository = sectionsRepository; _studentsRepository = studentsRepository; addEditSectionViewModel = ContainerHelper.Container.Resolve <AddEditSectionViewModel>(); EditCommand = new RelayCommand <Section>(OnEdit, CanEdit); AddCommand = new RelayCommand(OnAdd); DeleteCommand = new RelayCommand <Section>(OnDelete, CanDelete); AddRequested += NavToAddSection; EditRequested += NavToEditSection; addEditSectionViewModel.Done += NavToSection; Initialize(); }