-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataRepository.cpp
38 lines (32 loc) · 1.02 KB
/
DataRepository.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Created by Claudio Delgado on 2024-11-11.
//
#include "DataRepository.h"
void DataRepository::addStudent(const std::shared_ptr<Student>& student) {
students.push_back(student);
}
void DataRepository::addCourse(const std::shared_ptr<Course>& course) {
courses.push_back(course);
}
std::shared_ptr<Student> DataRepository::getStudentByRollNumber(const std::string& rollNumber) {
for (const auto& student : students) {
if (student->getRollNumber() == rollNumber) {
return student;
}
}
return nullptr;
}
std::shared_ptr<Course> DataRepository::getCourseByCode(const std::string& code) {
for (const auto& course : courses) {
if (course->getCode() == code) {
return course;
}
}
return nullptr;
}
void DataRepository::saveStudentData(const std::shared_ptr<Student>& student) {
// Implementation for saving student data
}
void DataRepository::saveCourseData(const std::shared_ptr<Course>& course) {
// Implementation for saving course data
}