本文整理汇总了C#中Schedule.DataLayer.ScheduleContext.SaveChanges方法的典型用法代码示例。如果您正苦于以下问题:C# ScheduleContext.SaveChanges方法的具体用法?C# ScheduleContext.SaveChanges怎么用?C# ScheduleContext.SaveChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule.DataLayer.ScheduleContext
的用法示例。
在下文中一共展示了ScheduleContext.SaveChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddConfigOption
public ConfigOption AddConfigOption(ConfigOption co)
{
using (var context = new ScheduleContext(ConnectionString))
{
context.Config.Add(co);
context.SaveChanges();
return co;
}
}
示例2: AddTeacher
public Teacher AddTeacher(Teacher teacher)
{
using (var context = new ScheduleContext(ConnectionString))
{
teacher.TeacherId = 0;
context.Teachers.Add(teacher);
context.SaveChanges();
return teacher;
}
}
示例3: AddTeacherForDisciplineRange
public void AddTeacherForDisciplineRange(IEnumerable<TeacherForDiscipline> teacherForDisciplineList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var teacherForDiscipline in teacherForDisciplineList)
{
teacherForDiscipline.TeacherForDisciplineId = 0;
context.TeacherForDiscipline.Add(teacherForDiscipline);
}
context.SaveChanges();
}
}
示例4: AddStudentGroup
public StudentGroup AddStudentGroup(StudentGroup studentGroup)
{
using (var context = new ScheduleContext(ConnectionString))
{
studentGroup.StudentGroupId = 0;
context.StudentGroups.Add(studentGroup);
context.SaveChanges();
return studentGroup;
}
}
示例5: AddStudentsInGroups
public StudentsInGroups AddStudentsInGroups(StudentsInGroups studentsInGroups)
{
using (var context = new ScheduleContext(ConnectionString))
{
studentsInGroups.StudentsInGroupsId = 0;
studentsInGroups.Student = context.Students.FirstOrDefault(s => s.StudentId == studentsInGroups.Student.StudentId);
studentsInGroups.StudentGroup = context.StudentGroups.FirstOrDefault(sg => sg.StudentGroupId == studentsInGroups.StudentGroup.StudentGroupId);
context.StudentsInGroups.Add(studentsInGroups);
context.SaveChanges();
return studentsInGroups;
}
}
示例6: AddRingRange
public void AddRingRange(IEnumerable<Ring> ringList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var ring in ringList)
{
ring.RingId = 0;
context.Rings.Add(ring);
}
context.SaveChanges();
}
}
示例7: AddScheduleNoteRange
public void AddScheduleNoteRange(IEnumerable<ScheduleNote> scheduleNoteList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var sNote in scheduleNoteList)
{
sNote.ScheduleNoteId = 0;
context.ScheduleNotes.Add(sNote);
}
context.SaveChanges();
}
}
示例8: AddFaculty
public Faculty AddFaculty(Faculty faculty)
{
using (var context = new ScheduleContext(ConnectionString))
{
faculty.FacultyId = 0;
context.Faculties.Add(faculty);
context.SaveChanges();
return faculty;
}
}
示例9: AddFacultyRange
public void AddFacultyRange(IEnumerable<Faculty> facultyList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var faculty in facultyList)
{
faculty.FacultyId = 0;
context.Faculties.Add(faculty);
}
context.SaveChanges();
}
}
示例10: AddExam
public Exam AddExam(Exam exam)
{
using (var context = new ScheduleContext(ConnectionString))
{
exam.ExamId = 0;
context.Exams.Add(exam);
context.SaveChanges();
return exam;
}
}
示例11: AddExamsRange
public void AddExamsRange(IEnumerable<Exam> examList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var exam in examList)
{
exam.ExamId = 0;
context.Exams.Add(exam);
}
context.SaveChanges();
}
}
示例12: AddDisciplineRange
public void AddDisciplineRange(IEnumerable<Discipline> disciplineList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var discipline in disciplineList)
{
var disciplineGroup = context.StudentGroups.FirstOrDefault(sg => sg.StudentGroupId == discipline.StudentGroup.StudentGroupId);
discipline.StudentGroup = disciplineGroup;
context.Disciplines.Add(discipline);
}
context.SaveChanges();
}
}
示例13: AddDiscipline
public Discipline AddDiscipline(Discipline discipline)
{
using (var context = new ScheduleContext(ConnectionString))
{
discipline.StudentGroup = context.StudentGroups.FirstOrDefault(sg => sg.StudentGroupId == discipline.StudentGroup.StudentGroupId);
context.Disciplines.Add(discipline);
context.SaveChanges();
return discipline;
}
}
示例14: AddConfigOptionRange
public void AddConfigOptionRange(IEnumerable<ConfigOption> coList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var co in coList)
{
co.ConfigOptionId = 0;
context.Config.Add(co);
}
context.SaveChanges();
}
}
示例15: AddLogEvent
public LogEvent AddLogEvent(LogEvent logEvent)
{
using (var context = new ScheduleContext(ConnectionString))
{
logEvent.OldExam = context.Exams.FirstOrDefault(e => e.ExamId == logEvent.OldExam.ExamId);
logEvent.NewExam = context.Exams.FirstOrDefault(e => e.ExamId == logEvent.NewExam.ExamId);
context.EventLog.Add(logEvent);
context.SaveChanges();
return logEvent;
}
}