public async Task <IActionResult> Index(string educationSearch = null) { ViewBag.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.search = educationSearch; List <Student> result = new List <Student>(); if (string.IsNullOrEmpty(educationSearch)) { result = (await studentRepo.GetAllStudentsAsync()).ToList(); } else { var educations = await educationRepo.GetAllEducationsAsync(educationSearch); // Alle mogelijkheden Testen --> Zeker null dus!!! if (educations == null) { return(View("_NotFound")); } foreach (Education education in educations) { var resultStudents = await studentRepo.GetStudentsByEducationAsync(education.Id); foreach (var student in resultStudents) { result.Add(student); } } } return(View("Index", result)); }
public StudentEducationVM(IEducationRepo_DbContext educationRepo, Student student) { this.Student = student; //Selectlist houdt geselecteerde waarde bij.(EducationId) this.ListEducation = new SelectList(educationRepo.GetAllEducationsAsync().Result, "Id", "Name", student.EducationId); }
public TeacherEducationsVM(IEducationRepo_DbContext educationRepo, Teacher teacher, IEnumerable <Education> SelectedEducations) { Teacher = teacher; this.SelectedEducations = SelectedEducations; this.ListEducations = new MultiSelectList(educationRepo.GetAllEducationsAsync().Result, "Education.Id", "Education.Name", SelectedEducations); }
// GET: Education public async Task <ActionResult> Index() { return(View(await EducationRepo.GetAllEducationsAsync())); }