Skip to content

Commit

Permalink
Merge pull request #84 from kzi-nastava/feat/CourseController-Update
Browse files Browse the repository at this point in the history
[Add] method IsCourseValid to CourseController Class
  • Loading branch information
DusicaPesic authored Mar 30, 2024
2 parents eb38fa3 + 224bb6f commit 720e9a5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions LangLang/Core/Controller/CourseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ public void Subscribe(IObserver observer)
_courses.Subscribe(observer);
}

// Method checks if a certain course is available for the student
public bool isCourseAvailable(int id)
// Method checks if the course is valid for updating or canceling
public bool IsCourseValid(int courseId)
{
Course course = GetAllCourses()[id];

Check failure on line 41 in LangLang/Core/Controller/CourseController.cs

View workflow job for this annotation

GitHub Actions / build

The name 'id' does not exist in the current context

Check failure on line 41 in LangLang/Core/Controller/CourseController.cs

View workflow job for this annotation

GitHub Actions / build

The name 'id' does not exist in the current context
TimeSpan difference = course.StartDate - DateTime.Now;
return difference.TotalDays < 7;
}

// Method checks if a certain course is available for the student
public bool IsCourseAvailable(int courseId)
{
Course course = GetAllCourses()[courseId];
TimeSpan difference = course.StartDate - DateTime.Now;
if (difference.TotalDays < 7)
{
if (course.Online)
Expand Down

0 comments on commit 720e9a5

Please sign in to comment.