// GET: Education ---------------------------------------------------READ public async Task <ActionResult> IndexAsync(string search = null) { var educations = await educationRepo.GetAllEducationsAsync(search); if (!String.IsNullOrEmpty(search)) { educations = await educationRepo.GetAllEducationsAsync(search); } return(View(educations));; }
// GET: Student/Create public async Task <ActionResult> Create() { List <Education> educationList = new List <Education>(); educationList.Insert(0, new Education { Name = "--Kies een opleiding --" }); educationList.AddRange(await educationRepo.GetAllEducationsAsync()); SelectList selectListItems = new SelectList(educationList, "Id", "Name"); ViewData["Educations"] = selectListItems; return(View()); }
} //helper voor HTTP public TeacherEducationsVM(IEducationRepo educationRepo, Teacher teacher) { this.Teacher = teacher; this.SelectedEducations = educationRepo.GetAllEducationsByTeacher(Teacher.Id); this.Educations = new MultiSelectList(educationRepo.GetAllEducationsAsync().Result, "Id", "Name", SelectedEducations); }
public StudentEducationVm(IEducationRepo educationRepo, Student student) { this.Student = student; //Selectlist houdt geselecteerde waarde bij.(bij edit indien EducationId) this.Education = new SelectList(educationRepo.GetAllEducationsAsync(null).Result, "Id", "Name", student.EducationId); }