using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Posechaemost.Data.LocalData; using Posechaemost.Data.LocalData.Entity; using Posechaemost.Domain.Models; namespace Posechaemost.Data.Repository { public class PresenceRepositoryImpl: IPresenceRepository { public PresenceRepositoryImpl() { GetAllPresences = LocalStaticData.presences; } public List GetAllPresences { get; set; } public void AddPresence(PresenceLocalEntity presence) { PresenceLocalEntity? presenceLocal = GetAllPresences.FirstOrDefault(); // GroupLocalEntity? group = new GroupLocalEntity(); presenceLocal.ClassNumber = presence.ClassNumber; presence.UserGuid = presence.UserGuid; presenceLocal.Date = presence.Date; presenceLocal.IsAttendence = presence.IsAttendence; } 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, Guid userGuid) { var presToUpdate = GetAllPresences .Where(x => x.UserGuid == userGuid && x.ClassNumber >= firstClass && x.ClassNumber <= lastClass && x.Date == date).ToList(); foreach (var pres in presToUpdate) { pres.IsAttendence = false; } return true; } } }