Add Event Calendar feature with event occurrences service integration
Introduced a new Event Calendar component that displays scheduled events using the Heron.MudCalendar. Implemented IEventOccurrenceService to fetch event occurrences, and added mock data for initial testing. Updated navigation menu to include a link to the Event Calendar.
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
using Core.Entities;
|
||||
|
||||
namespace WebApp.Services;
|
||||
|
||||
public class EventOccurrenceService : IEventOccurrenceService
|
||||
{
|
||||
public Task<IEnumerable<EventOccurrence>> GetEventOccurrencesAsync()
|
||||
{
|
||||
// Mock data for demonstration purposes
|
||||
// This will be replaced with database-backed implementation later
|
||||
var mockOccurrences = new List<EventOccurrence>
|
||||
{
|
||||
new EventOccurrence
|
||||
{
|
||||
Name = "Opening Ceremony",
|
||||
Date = "March 15",
|
||||
Time = "8:00 a.m.",
|
||||
StartTime = new DateTime(2026, 3, 15, 8, 0, 0),
|
||||
EndTime = new DateTime(2026, 3, 15, 9, 0, 0),
|
||||
Location = "Main Auditorium"
|
||||
},
|
||||
new EventOccurrence
|
||||
{
|
||||
Name = "Sign-up",
|
||||
Date = "March 15",
|
||||
Time = "9:30 a.m.",
|
||||
StartTime = new DateTime(2026, 3, 15, 9, 30, 0),
|
||||
EndTime = new DateTime(2026, 3, 15, 11, 0, 0),
|
||||
Location = "Registration Hall"
|
||||
},
|
||||
new EventOccurrence
|
||||
{
|
||||
Name = "Judging",
|
||||
Date = "March 15",
|
||||
Time = "1:00 p.m.",
|
||||
StartTime = new DateTime(2026, 3, 15, 13, 0, 0),
|
||||
EndTime = new DateTime(2026, 3, 15, 17, 0, 0),
|
||||
Location = "Exhibition Hall"
|
||||
},
|
||||
new EventOccurrence
|
||||
{
|
||||
Name = "Submit",
|
||||
Date = "March 16",
|
||||
Time = "8:00 a.m.",
|
||||
StartTime = new DateTime(2026, 3, 16, 8, 0, 0),
|
||||
EndTime = new DateTime(2026, 3, 16, 10, 0, 0),
|
||||
Location = "Submission Desk"
|
||||
},
|
||||
new EventOccurrence
|
||||
{
|
||||
Name = "Competition 1",
|
||||
Date = "March 16",
|
||||
Time = "10:30 a.m.",
|
||||
StartTime = new DateTime(2026, 3, 16, 10, 30, 0),
|
||||
EndTime = new DateTime(2026, 3, 16, 12, 0, 0),
|
||||
Location = "Competition Hall"
|
||||
},
|
||||
new EventOccurrence
|
||||
{
|
||||
Name = "Competition 2",
|
||||
Date = "March 16",
|
||||
Time = "10:30 a.m.",
|
||||
StartTime = new DateTime(2026, 3, 16, 11, 30, 0),
|
||||
EndTime = new DateTime(2026, 3, 16, 13, 0, 0),
|
||||
Location = "Competition Hall"
|
||||
},
|
||||
new EventOccurrence
|
||||
{
|
||||
Name = "Awards Ceremony",
|
||||
Date = "March 17",
|
||||
Time = "2:00 p.m.",
|
||||
StartTime = new DateTime(2026, 3, 17, 14, 0, 0),
|
||||
EndTime = new DateTime(2026, 3, 17, 16, 0, 0),
|
||||
Location = "Main Auditorium"
|
||||
}
|
||||
};
|
||||
|
||||
return Task.FromResult<IEnumerable<EventOccurrence>>(mockOccurrences);
|
||||
}
|
||||
|
||||
public Task<IEnumerable<EventOccurrence>> GetEventOccurrencesForDateRangeAsync(DateTime start, DateTime end)
|
||||
{
|
||||
return GetEventOccurrencesAsync().ContinueWith(task =>
|
||||
{
|
||||
var allOccurrences = task.Result;
|
||||
return allOccurrences.Where(eo =>
|
||||
eo.StartTime.Date >= start.Date &&
|
||||
eo.StartTime.Date <= end.Date);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user