private Controller() { IPersistable persistable = new DbController(); _clientRepo = ClientRepo.GetInstance(persistable); _clientRepo.NewClientEventHandler += NewClientEventHandler; _practitionerRepo = PractitionerRepo.GetInstance(persistable); _departmentRepo = DepartmentRepo.GetInstance(persistable, _practitionerRepo.GetPractitioners()); _appointmentRepo = AppointmentRepo.GetInstance(persistable, GetUsers(), _departmentRepo.GetDepartments()); _appointmentRepo.AppointmentsChangedEventHandler += AppointmentsChangedEventHandler; UpdateFromDatabase updateFromDatabase = UpdateFromDatabase.GetInstance(persistable, _clientRepo.GetClients(), _appointmentRepo.GetAppointments(), _practitionerRepo.GetPractitioners(), _departmentRepo.GetDepartments()); updateFromDatabase.ClientsUpdatedEventHandler += _clientRepo.Update; updateFromDatabase.AppointmentsUpdatedEventHandler += _appointmentRepo.Update; }
public List <string> GetDepartmentNames() { List <Department> departments = _departmentRepo.GetDepartments(); return(departments.ConvertAll(department => department.Name)); }