Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface IDBcontext
- {
- List<Student> GetAllStudents();
- List<Klass> GetAllKlasses();
- Student FindStudentById(int studentID);
- void RemoveStudent(Student);
- void SaveStudent(Student);
- // Other methods if needed
- // The same for klass....
- Klass FindKlassById(int klassID);
- }
- class XmlDBContext : IDBContext
- {
- XmlDBContext(string filename) {}
- }
- class Program
- {
- IDBContext dbContext;
- IWindowOperations ops;
- public static void Main(string[] args)
- {
- dbContext = new XmlDBContext("file.xml");
- // ...
- var student = dbContext.findStudentById(studentId);
- if (student == null)
- {
- ops.Error("Student doesn't exist");
- }
- else
- {
- ops.LoadStudentToEdit(student);
- dbContext.Save(student);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement