public static List <Enrollment> GetEnrollmentForACourse(string cnum = null, string userName = null) { if (userName != null) { long studentId = RepositoryAuth.VerifyUser(userName); if (studentId == 0) { throw new Exception("Error!!"); } else { if (cnum == null) { return(RepositoryRegistrar.GetEnrollmentForACourse(null, studentId)); } else { return(RepositoryRegistrar.GetEnrollmentForACourse(cnum, studentId)); } } } else { return(RepositoryRegistrar.GetEnrollmentForACourse(cnum, 0)); } }
public static bool SignUpCourse(string username, string cnum, string semester) { bool res = false; long studentId = RepositoryAuth.VerifyUser(username); try { if (studentId != 0) { List <Enrollment> cs = RepositoryRegistrar.GetEnrollmentForACourse(cnum, studentId); if (cs.Count == 0) { if (RepositoryRegistrar.CheckPrerequisiteCourseTaken(studentId, cnum)) { res = RepositoryRegistrar.SignUpCourse(studentId, cnum, semester); } } } } catch (Exception) { throw; } return(res); }