using Core.Entities; using Data; using Microsoft.EntityFrameworkCore; namespace WebApp.Services; public class EventOccurrenceService : IEventOccurrenceService { private readonly AppDbContext _context; public EventOccurrenceService(AppDbContext context) { _context = context; } public async Task> GetEventOccurrencesAsync() { return await _context.EventOccurrences .Include(eo => eo.EventDefinition) .OrderBy(eo => eo.StartTime) .ToListAsync(); } public async Task> GetEventOccurrencesForDateRangeAsync(DateTime start, DateTime end) { return await _context.EventOccurrences .Include(eo => eo.EventDefinition) .Where(eo => eo.StartTime.Date >= start.Date && eo.StartTime.Date <= end.Date) .OrderBy(eo => eo.StartTime) .ToListAsync(); } }