示例#1
0
        public string Save(Models.CourseStudent courseStudent)
        {
            string query = "INSERT INTO CourseStudent(StudentId,CourseId,CourseStudentDate,Grade) VALUES ('" +
                           courseStudent.StudentId + "','" + courseStudent.CourseId + "','" + courseStudent.Date + "','')";

            Connection.Open();
            Command.CommandText = query;
            int rowsEffected = Command.ExecuteNonQuery();

            Connection.Close();
            return("Student has been Added to this course");
        }
示例#2
0
        public bool IsEnrollBefore(Models.CourseStudent courseStudent)
        {
            string query = "SELECT * FROM CourseStudent WHERE StudentId='" + courseStudent.StudentId + "' AND CourseId='" + courseStudent.CourseId + "'";

            Connection.Open();
            Command.CommandText = query;

            SqlDataReader reader = Command.ExecuteReader();

            if (reader.HasRows)
            {
                reader.Close();
                Connection.Close();
                return(true);
            }
            reader.Close();
            Connection.Close();
            return(false);
        }
示例#3
0
 public bool IsEnrollBefore(Models.CourseStudent courseStudent)
 {
     return(courseStudentGateway.IsEnrollBefore(courseStudent));
 }
示例#4
0
 public string Save(Models.CourseStudent courseStudent)
 {
     return(courseStudentGateway.Save(courseStudent));
 }