Demo/Data/Repository/PresenceRepositoryImpl.cs

37 lines
1.2 KiB
C#
Raw Normal View History

2024-10-23 19:46:46 +00:00
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;
}
}
}
}
}