示例#1
0
 public virtual void AddStudentCoursesBySp(int stdId, List <int> Courses)
 {
     foreach (var courseId in Courses)
     {
         StudentCourse studentCourseObj = new StudentCourse();
         studentCourseObj.StudentId = stdId;
         studentCourseObj.CourseId  = courseId;
         using (var context = new SchoolContext())
         {
             context.AddStudentCourseUsingSp(studentCourseObj);
             context.SaveChanges();
         }
     }
 }