Sherzy
8/2/2016 - 2:27 AM

Execute stored proc in EF

Execute stored proc in EF

// RTR proj DecaEntities context = new DecaEntities();

l8cEntities context = new l8cEntities();
var cmdText = "exec InsertTeacherCourseStudent @StudentId = @StudentId, @TeacherCourseId = @TeacherCourseId";
var @params = new[]{
    new SqlParameter("StudentId", s.StudentId),
    new SqlParameter("TeacherCourseId", tc.TeacherCourseId)
};
context.ExecuteStoreCommand(cmdText, @params);
l8cEntities context = new l8cEntities();
context.ExecuteStoreCommand("exec UpdateStudentSession " + model.TeacherSessionId);