// C:\Users\adm\Source\Repos\presence1\Demo\Data\Repository\PresenceRepositoryImpl.cs using System; using System.Collections.Generic; using System.Linq; using AttendanceApp.Domain.Models; using Demo.Data.LocalData; using Demo.Data.LocalData.Entity; using Demo.Data.RemoteData.RemoteDataBase; namespace Demo.Data.Repository { public class PresenceRepositoryImpl : IPresenceRepository { private RemoteDatabaseContext context; public PresenceRepositoryImpl(RemoteDatabaseContext context) { this.context = context; } public void AddPresence(LocalPresence presence) { LocalStaticData.Presences.Add(presence); } public IEnumerable GetAllPresences() { return LocalStaticData.Presences; } public IEnumerable GetPresenceByGroup(int groupId) { throw new NotImplementedException(); } public IEnumerable GetPresenceByGroupAndDate(int groupId, DateTime date) { throw new NotImplementedException(); } public IEnumerable GetPresencesByGroupAndDate(int groupId, DateTime date) { var usersInGroup = LocalStaticData.Users.Where(u => u.GroupID == groupId).Select(u => u.Id).ToList(); return LocalStaticData.Presences.Where(p => usersInGroup.Contains(p.UserId) && p.ClassDate.Date == date.Date); } public void UpdatePresence(LocalPresence presence) { var existingPresence = LocalStaticData.Presences.FirstOrDefault(p => p.UserId == presence.UserId && p.ClassDate.Date == presence.ClassDate.Date && p.LessonNumber == presence.LessonNumber); if (existingPresence != null) { existingPresence.WasPresent = presence.WasPresent; } } public void UpdatePresence(Presence presence) { throw new NotImplementedException(); } IEnumerable IPresenceRepository.GetPresenceByGroup(int groupId) { throw new NotImplementedException(); } } }