public List <StudentResultShow> GetResultByRegistrationId(int studentRegisterId) { List <StudentResultShow> resultList = _studentResultGateway.GetResultByRegistrationId(studentRegisterId); List <Course> enrolledCourseList = _studentEnrollManager.GetEnrolledCoursesByStudentId(studentRegisterId); List <StudentResultShow> newResultList = new List <StudentResultShow>(); StudentResultShow studentResult = null; foreach (Course course in enrolledCourseList) { bool flag = false; foreach (StudentResultShow resultShow in resultList) { if (resultShow.CourseName == course.CourseName) { newResultList.Add(resultShow); flag = true; break; } } if (!flag) { studentResult = new StudentResultShow(); string grade = "Not Graded Yet"; studentResult.CourseCode = course.CourseCode; studentResult.CourseName = course.CourseName; studentResult.GradeName = grade; newResultList.Add(studentResult); } } return(newResultList); }