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(); } }
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(); } }
public void Remove(Semester semester) { using (var db = new ElJournalDbContext()) { db.Semesters.Remove(semester); db.SaveChanges(); } }
public void Remove(Teacher teacher) { using (var db = new ElJournalDbContext()) { db.Teachers.Remove(teacher); db.SaveChanges(); } }
public void Remove(Admin admin) { using (var db = new ElJournalDbContext()) { db.Admins.Remove(admin); db.SaveChanges(); } }
public void Remove(Subject subject) { using (var db = new ElJournalDbContext()) { db.Subjects.Remove(subject); db.SaveChanges(); } }
public void Remove(Student student) { using (var db = new ElJournalDbContext()) { db.Students.Remove(student); db.SaveChanges(); } }
public void Remove(User user) { using (var db = new ElJournalDbContext()) { db.Users.Remove(user); db.SaveChanges(); } }
public void Remove(Lesson lesson) { using (var db = new ElJournalDbContext()) { db.Lessons.Remove(lesson); db.SaveChanges(); } }
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(); } }
public void Remove(Mark mark) { using (var db = new ElJournalDbContext()) { db.Marks.Remove(mark); db.SaveChanges(); } }
public void SetValue(int markid, string value) { using (var db = new ElJournalDbContext()) { var selectedmark = db.Marks.Find(markid); selectedmark.Value = value; db.SaveChanges(); } }
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(); } }
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(); } }
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(); } }
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(); } }