// GET: Student ---------------------------------------------------READ public async Task <ActionResult> IndexAsync(string search = null) { var students = await studentRepo.GetAllStudentsAsync(search); if (!String.IsNullOrEmpty(search)) { students = await studentRepo.GetAllStudentsAsync(search); } return(View(students)); }
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)); }
// GET: Student public async Task <IActionResult> Index() { var students = await studentRepo.GetAllStudentsAsync(); return(View(students)); }