예제 #1
0
 public void AddTeacher(Teacher teacher, User user)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Users.Add(user);
         db.SaveChanges();
         var newuser = db.Users.FirstOrDefault(u => u.Login == user.Login);
         teacher.UserID = newuser.UserID;
         db.Teachers.Add(teacher);
         db.SaveChanges();
     }
 }
예제 #2
0
 public void AddAdmin(Admin admin, User user)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Users.Add(user);
         db.SaveChanges();
         var newuser = db.Users.FirstOrDefault(u => u.Login == user.Login);
         admin.UserID = newuser.UserID;
         db.Admins.Add(admin);
         db.SaveChanges();
     }
 }
예제 #3
0
 public void Remove(Semester semester)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Semesters.Remove(semester);
         db.SaveChanges();
     }
 }
예제 #4
0
 public void Remove(Teacher teacher)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Teachers.Remove(teacher);
         db.SaveChanges();
     }
 }
예제 #5
0
 public void Remove(Admin admin)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Admins.Remove(admin);
         db.SaveChanges();
     }
 }
예제 #6
0
 public void Remove(Subject subject)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Subjects.Remove(subject);
         db.SaveChanges();
     }
 }
예제 #7
0
 public void Remove(Student student)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Students.Remove(student);
         db.SaveChanges();
     }
 }
예제 #8
0
 public void Remove(User user)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Users.Remove(user);
         db.SaveChanges();
     }
 }
예제 #9
0
 public void Remove(Lesson lesson)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Lessons.Remove(lesson);
         db.SaveChanges();
     }
 }
예제 #10
0
 public void Remove(Group group)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Groups.Remove(group);
         db.SaveChanges();
     }
 }
 public void Remove(TeacherToSubject teacherToSubject)
 {
     using (var db = new ElJournalDbContext())
     {
         db.TeacherToSubjects.Remove(teacherToSubject);
         db.SaveChanges();
     }
 }
 public void Remove(GroupToSubject grouptosubject)
 {
     using (var db = new ElJournalDbContext())
     {
         db.GroupToSubjects.Remove(grouptosubject);
         db.SaveChanges();
     }
 }
예제 #13
0
 public void Remove(Mark mark)
 {
     using (var db = new ElJournalDbContext())
     {
         db.Marks.Remove(mark);
         db.SaveChanges();
     }
 }
예제 #14
0
 public void SetValue(int markid, string value)
 {
     using (var db = new ElJournalDbContext())
     {
         var selectedmark = db.Marks.Find(markid);
         selectedmark.Value = value;
         db.SaveChanges();
     }
 }
예제 #15
0
 public void EditGroup(int id, Group group)
 {
     using (var db = new ElJournalDbContext())
     {
         var selectedGroup = db.Groups.FirstOrDefault(g => g.GroupID == id);
         selectedGroup.Name   = group.Name;
         selectedGroup.Course = group.Course;
         db.SaveChanges();
     }
 }
예제 #16
0
 public void EditSubject(int id, Subject newsubject)
 {
     using (var db = new ElJournalDbContext())
     {
         var subject = db.Subjects.FirstOrDefault(s => s.SubjectID == id);
         subject.ShortName = newsubject.ShortName;
         subject.Name      = newsubject.Name;
         db.SaveChanges();
     }
 }
예제 #17
0
 public void EditTeacher(int id, Teacher newteacher)
 {
     using (var db = new ElJournalDbContext())
     {
         var teacher = db.Teachers.FirstOrDefault(t => t.TeacherID == id);
         teacher.FirstName  = newteacher.FirstName;
         teacher.LastName   = newteacher.LastName;
         teacher.Patronymic = newteacher.Patronymic;
         db.SaveChanges();
     }
 }
예제 #18
0
 public void EditStudent(int id, Student newstudent)
 {
     using (var db = new ElJournalDbContext())
     {
         var student = db.Students.FirstOrDefault(s => s.StudentID == id);
         student.FirstName  = newstudent.FirstName;
         student.LastName   = newstudent.LastName;
         student.Patronymic = newstudent.Patronymic;
         student.GroupID    = newstudent.GroupID;
         db.SaveChanges();
     }
 }