Пример #1
0
        public static void UpdateStudentCourse(int studentCourseId, int studentId, int courseId, int mark)
        {
            bool submitChange = false;
            //update a student course
            StudentCourse studentCourse = db.StudentCourses.Single(sc => sc.Id.Equals(studentCourseId));

            if (studentCourse.studentId != studentId)
            {
                studentCourse.studentId = studentId;
                submitChange            = true;
            }
            if (studentCourse.courseId != courseId)
            {
                studentCourse.courseId = courseId;
                submitChange           = true;
            }
            if (studentCourse.finalGrade != mark)
            {
                studentCourse.finalGrade = mark;
                submitChange             = true;
            }
            if (submitChange)
            {
                db.SubmitChanges();
            }
        }
Пример #2
0
        public static void DeleteStudentCourse(int studentCourseId)
        {
            //delete a student course by setting its isDeleted flag to 1
            StudentCourse studentCourse = db.StudentCourses.Single(sc => sc.Id.Equals(studentCourseId));

            studentCourse.isDeleted = 1;
            db.SubmitChanges();
        }
Пример #3
0
        public static void AddStudentCourse(int studentId, int courseId, int mark)
        {
            //add a new student course record by suppling the student id, course id and mark
            StudentCourse studentCourse = new StudentCourse();

            studentCourse.studentId  = studentId;
            studentCourse.courseId   = courseId;
            studentCourse.finalGrade = mark;
            db.StudentCourses.InsertOnSubmit(studentCourse);
            db.SubmitChanges();
        }
Пример #4
0
 partial void DeleteStudentCourse(StudentCourse instance);
Пример #5
0
 partial void UpdateStudentCourse(StudentCourse instance);
Пример #6
0
 partial void InsertStudentCourse(StudentCourse instance);