Last active
December 17, 2015 23:49
-
-
Save rudylee/5692232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private bool ValidRequisitieMeet(int userId, int subjectId) | |
| { | |
| // Fetch the enrollment passed status from configuration file | |
| var passed = TryToParse(ConfigurationManager.AppSettings.Get("EnrollmentStatusPassed")); | |
| var requisites = (from r in _context.Requisites | |
| where r.SubjectId == subjectId | |
| select r); | |
| // For the sake of readability, use traditional way | |
| foreach (var requisite in requisites) | |
| { | |
| var requisiteSubjectId = requisite.SubjectId; | |
| var enrolment = (from e in _context.Enrolments | |
| where e.SubjectId == requisiteSubjectId | |
| where e.UserProfileId == userId | |
| where e.EnrolmentStatus == passed | |
| select e).Count(); | |
| if (enrolment == 0) return false; | |
| } | |
| return true; | |
| } |
xerxesb
commented
Jun 2, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment