/// <summary> /// 新增课程 /// </summary> /// <param name="course"></param> /// <returns></returns> public int AddCourse(Course course) { string sql = "insert into Course(CourseName,CourseContent,ClassHour,Credit,CategoryId,TeacherId) "; sql += $"values('{course.CourseName}', '{course.CourseContent}', {course.ClassHour}, {course.Credit}, {course.CategoryId}, {course.TeacherId})"; return(SQLHelper.ExcuteNonQuery(sql)); }
/// <summary> /// 根据ID修改课程名称和内容 /// </summary> /// <param name="course"></param> /// <returns></returns> public int UpdateCourse(Course course) { string sql = $"update Course set CourseContent='{course.CourseContent}',CourseName='{course.CourseName}' where CourseId={course.CourseId}"; return(SQLHelper.ExcuteNonQuery(sql)); }
/// <summary> /// 根据ID删除课程 /// </summary> /// <param name="course"></param> /// <returns></returns> public int DeleteCourse(Course course) { string sql = $"delete from Course where CourseId={course.CourseId}"; return(SQLHelper.ExcuteNonQuery(sql)); }