Skip to content

Commit

Permalink
Updated to show all future events for country pages
Browse files Browse the repository at this point in the history
  • Loading branch information
leeenglestone committed Jan 18, 2024
1 parent 3397499 commit ef1feab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public static IEnumerable<ITechEvent> GetUpcomingEvents(IEnumerable<ITechEvent>
.OrderBy(x => x.StartDate);
}

public static IEnumerable<ITechEvent> GetFutureEvents(IEnumerable<ITechEvent> events)
{
return events.Where(x => x.StartDate.Date > DateTime.Now.Date) // Future events
.OrderBy(x => x.StartDate);
}

public static IEnumerable<ITechEvent> GetRecentEvents(IEnumerable<ITechEvent> events, int totalDays = 30)
{
return events.Where(x => DateTime.Now.Date > x.EndDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task<IActionResult> Country(string country)
model.Country = ToTitleCase(country);
model.Events = events;
model.CurrentEvents = TechEventCalendar.GetCurrentEvents(events);
model.UpcomingEvents = TechEventCalendar.GetUpcomingEvents(events);
model.UpcomingEvents = TechEventCalendar.GetFutureEvents(events);
model.RecentEvents = TechEventCalendar.GetRecentEvents(events);

ViewBag.Title = $"Tech Community Events in {model.Country}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
<br />

<h4>@Model.UpcomingEventsCount Upcoming Events</h4>
<h4>@Model.UpcomingEventsCount Future Events</h4>
@if (Model.UpcomingEvents.Any())
{
@await Html.PartialAsync("_EventsImages", Model.UpcomingEvents)
Expand Down

0 comments on commit ef1feab

Please sign in to comment.