diff --git a/src/TechCommunityCalendar.Solution/TechCommunityCalendar.Concretions/TechEventCalendar.cs b/src/TechCommunityCalendar.Solution/TechCommunityCalendar.Concretions/TechEventCalendar.cs index 189094b8..c6a0cfac 100644 --- a/src/TechCommunityCalendar.Solution/TechCommunityCalendar.Concretions/TechEventCalendar.cs +++ b/src/TechCommunityCalendar.Solution/TechCommunityCalendar.Concretions/TechEventCalendar.cs @@ -25,6 +25,12 @@ public static IEnumerable GetUpcomingEvents(IEnumerable .OrderBy(x => x.StartDate); } + public static IEnumerable GetFutureEvents(IEnumerable events) + { + return events.Where(x => x.StartDate.Date > DateTime.Now.Date) // Future events + .OrderBy(x => x.StartDate); + } + public static IEnumerable GetRecentEvents(IEnumerable events, int totalDays = 30) { return events.Where(x => DateTime.Now.Date > x.EndDate diff --git a/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Controllers/CountryController.cs b/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Controllers/CountryController.cs index 40804dad..b0de10d5 100644 --- a/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Controllers/CountryController.cs +++ b/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Controllers/CountryController.cs @@ -26,7 +26,7 @@ public async Task 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}"; diff --git a/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Views/Country/Country.cshtml b/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Views/Country/Country.cshtml index 45f6d21c..12df1baf 100644 --- a/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Views/Country/Country.cshtml +++ b/src/TechCommunityCalendar.Solution/TechCommunityCalendar.CoreWebApplication/Views/Country/Country.cshtml @@ -26,7 +26,7 @@ }
-

@Model.UpcomingEventsCount Upcoming Events

+

@Model.UpcomingEventsCount Future Events

@if (Model.UpcomingEvents.Any()) { @await Html.PartialAsync("_EventsImages", Model.UpcomingEvents)