Demo/Data/Repository/PresenceRepositoryImpl.cs
2024-10-23 22:46:46 +03:00

37 lines
1.2 KiB
C#

using Demo.domain.Models;
namespace Demo.Data.Repository
{
public class PresenceRepositoryImpl : IPresenceRepository
{
public List<PresenceLocalEntity> GetAllPresences = new List<PresenceLocalEntity>();
public List<PresenceLocalEntity> GetPresences()
{
return GetAllPresences;
}
public List<PresenceLocalEntity> GetPresencesByGroup()
{
return GetAllPresences;
}
public List<PresenceLocalEntity> GetPresencesByGroupAndDate()
{
return GetAllPresences;
}
public List<PresenceLocalEntity> SavePresence(List<PresenceLocalEntity> presenceLocalEntities){
GetAllPresences.AddRange(presenceLocalEntities);
return presenceLocalEntities;
}
public void UpdateAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid){
foreach(PresenceLocalEntity presence in GetAllPresences.Where(x => x.LessonNumber >= firstLesson && x.LessonNumber <= lastLesson && x.Date == date)){
if (presence.UserGuid == UserGuid){
presence.IsAttedance = false;
}
}
}
}
}