diff --git a/eventhub/src/EventHub.Application/Events/EventAppService.cs b/eventhub/src/EventHub.Application/Events/EventAppService.cs
index 37b7e1e..72261c4 100644
--- a/eventhub/src/EventHub.Application/Events/EventAppService.cs
+++ b/eventhub/src/EventHub.Application/Events/EventAppService.cs
@@ -79,7 +79,16 @@ namespace EventHub.Events
var totalCount = await AsyncExecuter.CountAsync(query);
- query = query.PageBy(input).OrderBy(x => x.@event.StartTime);
+ query = query.PageBy(input);
+
+ if (input.MaxDate.HasValue && !input.MinDate.HasValue)
+ {
+ query = query.OrderByDescending(x => x.@event.StartTime);
+ }
+ else
+ {
+ query = query.OrderBy(x => x.@event.StartTime);
+ }
var items = await AsyncExecuter.ToListAsync(query);
var now = Clock.Now;
diff --git a/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json
index c627ce8..d0d9419 100644
--- a/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json
+++ b/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json
@@ -33,6 +33,8 @@
"EventRegisterSuccessMessage": "We will send a reminder email before the event.",
"EventRegistrationCancelledMessage": "Your event registration has been cancelled.",
"OrganizedBy": "Organized by",
- "NoEventOrganizedByThisOrganizationYet": "No event organized by this organization yet!"
+ "NoEventOrganizedByThisOrganizationYet": "No event organized by this organization yet!",
+ "Upcoming": "Upcoming",
+ "Past": "Past"
}
}
diff --git a/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml b/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml
index 96be27d..e1f535a 100644
--- a/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml
+++ b/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml
@@ -20,30 +20,56 @@
-@if (Model.Events.Any())
+@if (Model.UpcomingEvents.Any())
{
-
Upcoming Events
+ Events
-
- @foreach (var eventItem in Model.Events)
- {
-
-
-
-
- @eventItem.Title
-
- @EventDateHelper.GetDateRangeText(eventItem.StartTime, eventItem.EndTime)
-
-
- @eventItem.Description.TruncateWithPostfix(100)
-
- @L["SeeEvent"]
-
-
-
- }
-
+
+
+
+ @foreach (var eventItem in Model.UpcomingEvents)
+ {
+
+
+
+
+ @eventItem.Title
+
+ @EventDateHelper.GetDateRangeText(eventItem.StartTime, eventItem.EndTime)
+
+
+ @eventItem.Description.TruncateWithPostfix(100)
+
+ @L["SeeEvent"]
+
+
+
+ }
+
+
+
+
+ @foreach (var eventItem in Model.PastEvents)
+ {
+
+
+
+
+ @eventItem.Title
+
+ @EventDateHelper.GetDateRangeText(eventItem.StartTime, eventItem.EndTime)
+
+
+ @eventItem.Description.TruncateWithPostfix(100)
+
+ @L["SeeEvent"]
+
+
+
+ }
+
+
+
}
else
{
diff --git a/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml.cs b/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml.cs
index a62c4f0..73572dc 100644
--- a/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml.cs
+++ b/eventhub/src/EventHub.Web/Pages/Organizations/Profile.cshtml.cs
@@ -12,7 +12,11 @@ namespace EventHub.Web.Pages.Organizations
public string Name { get; set; }
public OrganizationProfileDto Organization { get; set; }
- public IReadOnlyList Events { get; private set; }
+ public IReadOnlyList UpcomingEvents { get; private set; }
+ public long UpcomingEventTotalCount { get; private set; }
+
+ public IReadOnlyList PastEvents { get; private set; }
+ public long PastEventTotalCount { get; private set; }
private readonly IEventAppService _eventAppService;
private readonly IOrganizationAppService _organizationAppService;
@@ -26,9 +30,19 @@ namespace EventHub.Web.Pages.Organizations
}
public async Task OnGetAsync()
+ {
+ await GetProfileAsync();
+ await GetUpcomingEventsAsync();
+ await GetPastEventsAsync();
+ }
+
+ private async Task GetProfileAsync()
{
Organization = await _organizationAppService.GetProfileAsync(Name);
+ }
+ private async Task GetUpcomingEventsAsync()
+ {
var result = await _eventAppService.GetListAsync(
new EventListFilterDto
{
@@ -36,8 +50,21 @@ namespace EventHub.Web.Pages.Organizations
OrganizationId = Organization.Id
}
);
+ UpcomingEvents = result.Items;
+ UpcomingEventTotalCount = result.TotalCount;
+ }
- Events = result.Items;
+ private async Task GetPastEventsAsync()
+ {
+ var result = await _eventAppService.GetListAsync(
+ new EventListFilterDto
+ {
+ MaxDate = Clock.Now,
+ OrganizationId = Organization.Id
+ }
+ );
+ PastEvents = result.Items;
+ PastEventTotalCount = result.TotalCount;
}
}
}