37 lines
1.2 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |