using presence.Data.LocalData; using presence.Data.LocalData.Entity; using presence.Data.RemoteData.RemoteDatabase.DAO; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Xml.Linq; namespace presence.Data.Repository { public class PresenceRepositoryImpl : IPresenceRepository { public List GetAllPresences { get; set; } public void AddPresence(PresenceDao presence) { PresenceDao? presenceLocal = GetAllPresences.FirstOrDefault(); presenceLocal.UserDaoUserId = presence.UserDaoUserId; presenceLocal.Date = presence.Date; presenceLocal.IsAttedance = presence.IsAttedance; presenceLocal.LessonNumber = presence.LessonNumber; } public List GetPresenceByGroup(int groupId) { return GetAllPresences; } public List GetPresenceByGroupAndDate(int groupId, DateOnly date) { return GetAllPresences; } public bool UnCheckAttendence(int firstClass, int lastClass, DateOnly date, int userId) { var presToUpdate = GetAllPresences .Where(x => x.UserDaoUserId == userId && x.LessonNumber >= firstClass && x.LessonNumber <= lastClass && x.Date == date).ToList(); foreach (var presence in presToUpdate) { presence.IsAttedance = false; } return true; } } }