public List <Course> GetListCourses() { List <Course> listCourses = new List <Course>(); var cmd = dbconn.SqlCommand("SELECT * FROM course"); var rd = cmd.ExecuteReader(); while (rd.Read()) { listCourses.Add(CourseReader.Read(ref rd)); } return(listCourses); }
public List <Course> GetShedule(string classID) { var listCourses = new List <Course>(); var cmd = dbconn.SqlCommand("SELECT c.* FROM section s JOIN course c ON s.course_id = c.id WHERE class_id=?", classID); var rd = cmd.ExecuteReader(); while (rd.Read()) { listCourses.Add(CourseReader.Read(ref rd)); } return(listCourses); }
public Course GetCourse(string courseID) { var cmd = dbconn.SqlCommand("SELECT * FROM course WHERE id=?", courseID); var rd = cmd.ExecuteReader(); Course course = null; while (rd.Read()) { course = CourseReader.Read(ref rd); } return(course); }