internal GetSettingsModel GetEligibleCourses(UserIdModel objReq) { using (var db = new WizzDataContext()) { GetSettingsModel objResponse = new GetSettingsModel(); //List<AcademicCoursesModel academic = new AcademicCoursesModel(); // List<tblTutorSubject> tutorSubList = new List<tblTutorSubject>(); // var userInfo = db.tblStudentRequests.Where(x => x.uniqueStudentRequestId == objReq.uniqueRequestId).FirstOrDefault(); var tutorSubList = db.usp_GetEligibleSubjects(Convert.ToInt32(objReq.userId)).ToList(); //foreach (var n in tutorSubList) //{ // switch (n.subjectType) // { // case 1: // // objResponse.listAcademicCourse.Add(n.fkSubjectId) // break; // case 2: // break; // case 3: // break; // default: // break; // } //} var courseData = db.tblCourses.Where(a => a.isDelete == false && a.isActive == true).ToList(); var classes = db.tblClasses.Where(a => a.isActive == true && a.isDelete != true).ToList(); var subjects = db.tblSubjects.Where(a => a.isActive == true && a.isDelete != true).ToList(); //foreach (var n in courseData) { // AcademicCoursesModel acModel = new AcademicCoursesModel(); // foreach (var c in classes) // { // ClassesModel clasModel = new ClassesModel(); // acModel.listClasses.Add(clasModel); // foreach (var s in subjects) // { // SubjectsNewModel subModel = new SubjectsNewModel(); // var temp = tutorSubList.Where(z => z.fkSubjectId == s.fkClassId).FirstOrDefault(); // if (temp != null) // { // clasModel.listSubejcts.Add(subModel); // objResponse.listAcademicCourse.Add(acModel); // } // } // } //} objResponse.listAcademicCourse = (from c in courseData.Where(a => a.isExtraCurricular == false) select new AcademicCoursesModel { courseId = Convert.ToString(c.pkId), courseName = c.courseName, isApproved = tutorSubList.Any(x => x.fkSubjectId == c.pkId && x.subjectType == 1).ToString(), listClasses = (from cl in classes.Where(a => a.fkCourseId == c.pkId) select new ClassesModel { classId = Convert.ToString(cl.pkId), className = cl.className, isApproved = tutorSubList.Any(x => x.fkSubjectId == cl.pkId && x.subjectType == 2).ToString(), listSubejcts = (from sub in subjects.Where(a => a.fkClassId == cl.pkId) select new SubjectsNewModel { subjectId = Convert.ToString(sub.pkId), isApproved = tutorSubList.Any(x => x.fkSubjectId == sub.pkId && x.subjectType == 3).ToString(), subjectName = sub.subjectName, }).ToList() }).ToList() }).ToList(); objResponse.listCurricularCourses = (from c in courseData.Where(a => a.isExtraCurricular == true) select new CurricularCoursesModel { courseId = Convert.ToString(c.pkId), courseName = c.courseName, isApproved = tutorSubList.Any(x => x.fkSubjectId == c.pkId && x.subjectType == 1).ToString(), listClasses = (from cl in classes.Where(a => a.fkCourseId == c.pkId) select new ClassesModel { classId = Convert.ToString(cl.pkId), className = cl.className, isApproved = tutorSubList.Any(x => x.fkSubjectId == cl.pkId && x.subjectType == 2).ToString(), listSubejcts = (from sub in subjects.Where(a => a.fkClassId == cl.pkId) select new SubjectsNewModel { subjectId = Convert.ToString(sub.pkId), isApproved = tutorSubList.Any(x => x.fkSubjectId == sub.pkId && x.subjectType == 3).ToString(), subjectName = sub.subjectName, }).ToList() }).ToList() }).ToList(); //objResponse.tutorList = tutorSubList; return objResponse; } // throw new NotImplementedException(); }