コード例 #1
0
ファイル: LinqLayer.cs プロジェクト: njdentre/RHSCodingClub
        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
ファイル: LinqLayer.cs プロジェクト: njdentre/RHSCodingClub
        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
ファイル: LinqLayer.cs プロジェクト: njdentre/RHSCodingClub
        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);