Demo/Data/Repository/PresenceRepositoryImpl.cs

41 lines
1.4 KiB
C#
Raw Normal View History

2024-10-22 18:51:54 +00:00
using Demo.Data.LocalData;
using Demo.Domain.Models;
namespace Demo.Data.Repository
{
public class PresenceRepositoryImpl : IPresenceRepository
{
public List<PresenceLocalEntity> GetAllPresence = new List<PresenceLocalEntity>{};
public List<PresenceLocalEntity> GetAllPresences(){
return GetAllPresence;
}
2024-10-23 07:53:19 +00:00
public List<PresenceLocalEntity> GetPresenceByGroup(){
2024-10-22 18:51:54 +00:00
return GetAllPresence;
}
public List<PresenceLocalEntity> GetPresenceByGroupDate(){
return GetAllPresence;
}
public List<PresenceLocalEntity> GeneratePresence(List<PresenceLocalEntity> presenceLocalEntities){
GetAllPresence.AddRange(presenceLocalEntities);
return presenceLocalEntities;
}
2024-10-23 07:53:19 +00:00
2024-10-23 09:14:11 +00:00
public List<PresenceLocalEntity> GeneratePresenceWeek(List<PresenceLocalEntity> presenceLocalEntities){
GetAllPresence.AddRange(presenceLocalEntities);
return presenceLocalEntities;
}
2024-10-23 07:53:19 +00:00
public void IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid){
foreach(PresenceLocalEntity presence in GetAllPresence.Where(x => x.LessonNumber >= firstLesson && x.LessonNumber <= lastLesson && x.Date == date)){
if (presence.UserGuid == UserGuid){
presence.IsAttedance = false;
}
}
}
2024-10-22 18:51:54 +00:00
}
2024-10-23 07:53:19 +00:00
}