using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Demo.Domain.UseCase { public class UseCasePresence { private Dictionary> attendanceRecords; public UseCasePresence() { attendanceRecords = new Dictionary>(); } public void MarkAttendance(string group, DateTime date) { if (!attendanceRecords.ContainsKey(group)) { attendanceRecords[group] = new List(); } attendanceRecords[group].Add(date); } public List GetAttendanceByGroup(string group) { if (attendanceRecords.ContainsKey(group)) { return attendanceRecords[group]; } return new List(); } public List GetAttendanceByGroupAndDate(string group, DateTime date) { if (attendanceRecords.ContainsKey(group)) { return attendanceRecords[group].Where(d => d.Date == date.Date).ToList(); } return new List(); } public void MarkUserAsAbsent(string group, DateTime startDate, DateTime endDate) { if (attendanceRecords.ContainsKey(group)) { for (DateTime date = startDate; date <= endDate; date = date.AddDays(1)) { attendanceRecords[group].Remove(date); } } } } }