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"); }
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); }
public bool IsEnrollBefore(Models.CourseStudent courseStudent) { return(courseStudentGateway.IsEnrollBefore(courseStudent)); }
public string Save(Models.CourseStudent courseStudent) { return(courseStudentGateway.Save(courseStudent)); }