public ActionResult Curriculum() { var schooljaren = _unitOfWork.GetRepository <Schooljaar>().GetAll().ToArray(); var laatsteSchooljaar = schooljaren.Last(); var arguments = new ModuleFilterSorterArguments { }; /*var queryPack = new ModuleQueryablePack(arguments, _unitOfWork.GetRepository<Module>().GetAll().AsQueryable()); * var modules = _filterSorterService.ProcessData(queryPack).ToList(); * var moduleList = new ModuleListViewModel(modules.Count()); * moduleList.AddModules(modules);*/ var competenties = _unitOfWork.GetRepository <Competentie>().GetAll().Where(x => x.Schooljaar == laatsteSchooljaar.JaarId).ToArray(); var leerlijnen = _unitOfWork.GetRepository <Leerlijn>().GetAll().Where(x => x.Schooljaar == laatsteSchooljaar.JaarId).ToArray(); var tags = _unitOfWork.GetRepository <Tag>().GetAll().Where(x => x.Schooljaar == laatsteSchooljaar.JaarId).ToArray(); var fases = _unitOfWork.GetRepository <Fase>().GetAll().Where(x => x.Schooljaar == laatsteSchooljaar.JaarId).ToArray(); var onderdelen = _unitOfWork.GetRepository <Onderdeel>().GetAll().ToArray(); var blokken = _unitOfWork.GetRepository <Blok>().GetAll().ToArray(); var modules = _unitOfWork.GetRepository <Module>().GetAll().Where(x => x.Schooljaar == laatsteSchooljaar.JaarId).ToArray(); var filterOptions = new FilterOptionsViewModel(); filterOptions.AddFases(fases); filterOptions.AddBlokken(blokken); var adminCurriculumVm = new AdminCurriculumViewModel { Competenties = competenties, Leerlijn = leerlijnen, Tags = tags, Fases = fases, //ModuleViewModels = moduleList, FilterOptions = filterOptions, Onderdeel = onderdelen, Modules = modules }; return(View(adminCurriculumVm)); }
public ActionResult Overview() { var maxSchooljaar = _unitOfWork.GetRepository <Schooljaar>().GetAll().Max(src => src.JaarId); //Collect the possible filter options the user can choose. var filterOptions = new FilterOptionsViewModel(); filterOptions.AddBlokken(_unitOfWork.GetRepository <Blok>().GetAll()); filterOptions.AddCompetenties(_unitOfWork.GetRepository <Competentie>().GetAll().Where(src => src.Schooljaar.Equals(maxSchooljaar))); filterOptions.AddECs(); filterOptions.AddFases(_unitOfWork.GetRepository <Fase>().GetAll().Where(src => src.Schooljaar.Equals(maxSchooljaar))); filterOptions.AddLeerjaren(_unitOfWork.GetRepository <Schooljaar>().GetAll()); filterOptions.AddLeerlijnen(_unitOfWork.GetRepository <Leerlijn>().GetAll().Where(src => src.Schooljaar.Equals(maxSchooljaar))); filterOptions.AddTags(_unitOfWork.GetRepository <Tag>().GetAll().Where(src => src.Schooljaar.Equals(maxSchooljaar))); //Construct the ViewModel. var moduleOverviewVm = new ModuleOverviewViewModel { FilterOptions = filterOptions }; return(View(moduleOverviewVm)); }
public void FilterOptionsFases() { // Arrange var filterViewModel = new FilterOptionsViewModel(); var allFases = _faseRepository.GetAll(); filterViewModel.AddFases(allFases); // Act // verwachte FaseNamen op basis van de DummyRepository var allFaseNamen = new List <string> { "Software Ontwikkeling", "Business Intelligence", "Software Architecture", "TestFase" }; // Assert <expected, actual> Assert.AreEqual(allFaseNamen.Count, filterViewModel.FaseNamen.Count()); Assert.AreEqual(allFaseNamen.Last(), filterViewModel.FaseNamen.Last()); Assert.AreEqual(allFaseNamen.ElementAt(2), filterViewModel.FaseNamen.ElementAt(2)); }