using Zurnal.RemaDateBase.DateDao; using static Zurnal.Presence.UseCaseGeneratePresence; namespace Zurnal.Domain.UseCase { internal class UseCasePresence { private List attendanceRecords; public UseCasePresence(List attendanceRecords) { this.attendanceRecords = attendanceRecords; } public List GetAttendanceByGroup(string groupNumber) { return attendanceRecords.Where(record => record.userDao.Group.GroupName == groupNumber).ToList(); } public List GetAttendanceByGroupAndDate(string groupNumber, DateOnly date) { return attendanceRecords.Where(record => record.userDao.Group.GroupName == groupNumber && record.Date == date).ToList(); } public void MarkUserAsAbsent(string groupNumber, int firstLesson, int lastLesson, DateOnly date) { foreach (var lesson in Enumerable.Range(firstLesson, lastLesson - firstLesson + 1)) { var record = attendanceRecords.FirstOrDefault(r => r.userDao.Group.GroupName == groupNumber && r.LessonNumber == lesson && r.Date == date); if (record != null) { record.IsAttendensy = false; } } } } }