public IActionResult Index() { Educator educator = educatorRepo.Get(2); List <Education> identityEducation = educationRepo.EducationsByEducator(educator); HomeIndexViewModel model = new HomeIndexViewModel { Date = DateTime.Now, IsChecked = false, CourseList = new List <Course>(), EducationList = new List <Education>() }; foreach (Education education in identityEducation) { List <Course> courseList = new List <Course>(); foreach (Student student in education.Students) { foreach (StudentCourse studentCourse in student.StudentCourses) { courseList.Add(studentCourse.Course); } } courseList = courseList.Distinct().ToList(); DayOfWeekCheck(courseList, education, model); } model.EducationList = model.EducationList.Distinct().ToList(); model.CheckedEducation = absenceRepo.EducationHasAbsence(model.EducationList, model.Date); ViewBag.TypeOfView = "education"; return(View("Index", model)); }