53 lines
2.0 KiB
C#
53 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Demo.Data.LocalData;
|
|
using Demo.Domain.Models;
|
|
|
|
namespace Demo.Data.Repository
|
|
{
|
|
public class PresenceRepositoryImpl : IPresenceRepository
|
|
{
|
|
private readonly List<LessonPresence> _presences = new List<LessonPresence>();
|
|
|
|
public List<User> GetUsersByGroup(int groupNumber)
|
|
{
|
|
// Здесь должна быть логика получения пользователей по номеру группы
|
|
return new List<User>
|
|
{
|
|
new User { Id = Guid.NewGuid(), FullName = "Иванов Иван", ClassId = groupNumber },
|
|
new User { Id = Guid.NewGuid(), FullName = "Петров Пётр", ClassId = groupNumber },
|
|
// Добавьте других пользователей по аналогии
|
|
};
|
|
}
|
|
|
|
public void SavePresence(List<LessonPresence> presenceList)
|
|
{
|
|
_presences.AddRange(presenceList);
|
|
}
|
|
|
|
public List<LessonPresence> GetPresenceByGroup(int groupNumber)
|
|
{
|
|
return _presences.FindAll(p => p.GroupID == groupNumber);
|
|
}
|
|
|
|
public List<LessonPresence> GetPresenceByGroupAndDate(int groupNumber, DateTime date)
|
|
{
|
|
return _presences.FindAll(p => p.GroupID == groupNumber && p.Date.Date == date.Date);
|
|
}
|
|
|
|
public void MarkUserAbsent(Guid userId, int groupNumber, int lessonIndex, DateTime date)
|
|
{
|
|
var presence = _presences.Find(p => p.UserId == userId && p.GroupID == groupNumber && p.Date.Date == date.Date);
|
|
if (presence != null && lessonIndex >= 0 && lessonIndex < presence.Lessons.Count)
|
|
{
|
|
presence.Lessons[lessonIndex] = false; // Отметим занятие как отсутствующее
|
|
}
|
|
}
|
|
|
|
public void UpdatePresence(LessonPresence presence)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|