public IList <ApplicationBEAN> GetApplications(string universityName) { int uniId = new UniversityDAO().GetUniversity(universityName).UniversityId; IApplicantDAO appDao = new ApplicantDAO(); return(context .Application .Where(r => r.UniversityId == uniId) .ToList() .Select(r => new ApplicationBEAN() { Id = r.Id , ApplicantId = r.ApplicantId , ApplicantName = appDao.GetApplicant(r.ApplicantId).ApplicantName , CourseName = r.CourseName , Firm = r.Firm , PersonalStatement = r.PersonalStatement , TeacherContactDetails = r.TeacherContactDetails , TeacherReference = r.TeacherReference , University = universityName , UniversityOffer = r.UniversityOffer }) .ToList()); }
public IList <ApplicationBEAN> GetApplications(int applicantId) { IUniversityDAO uniDao = new UniversityDAO(); IApplicantDAO appDao = new ApplicantDAO(); var applicantName = appDao.GetApplicant(applicantId).ApplicantName; return(context .Application .Where(r => r.ApplicantId == applicantId) .ToList() .Select(r => new ApplicationBEAN() { Id = r.Id , ApplicantId = r.ApplicantId , ApplicantName = applicantName , CourseName = r.CourseName , Firm = r.Firm , PersonalStatement = r.PersonalStatement , TeacherContactDetails = r.TeacherContactDetails , TeacherReference = r.TeacherReference , University = uniDao.GetUniversity(r.UniversityId).UniversityName , UniversityOffer = r.UniversityOffer }) .OrderBy(x => x.University) .ThenBy(x => x.CourseName) .ToList()); }