namespace Zurnal.Presence { internal class UseCaseGeneratePresence { internal class AttendanceRecord { public int LessonNumber { get; set; } public required string GroupNumber { get; set; } public DateTime Date { get; set; } public bool IsPresent { get; set; } } public List GenerateDailyAttendance(int firstLesson, int lastLesson, string groupNumber, DateTime currentDate) { List attendanceRecords = new List(); var users = Zurnal.RemaDateBase.DateDao.GroupDao.Name .FirstOrDefault(g => g.GroupName == groupNumber)?.Users; foreach (var user in users) { for (int lesson = firstLesson; lesson <= lastLesson; lesson++) { attendanceRecords.Add(new AttendanceRecord { LessonNumber = lesson, GroupNumber = groupNumber, Date = currentDate, IsPresent = true }); } } return attendanceRecords; } public List GenerateWeeklyAttendance(int firstLesson, int lastLesson, string groupNumber, DateTime startDate) { List weeklyAttendanceRecords = new List(); for (int day = 0; day < 7; day++) { DateTime currentDate = startDate.AddDays(day); weeklyAttendanceRecords.AddRange(GenerateDailyAttendance(firstLesson, lastLesson, groupNumber, currentDate)); } return weeklyAttendanceRecords; } } }