49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Demo.Data.LocalData.Entity;
|
|||
|
using Demo.Data.Repository;
|
|||
|
|
|||
|
namespace Demo.Domain.UseCase
|
|||
|
{
|
|||
|
public class AttendanceUseCase
|
|||
|
{
|
|||
|
private readonly AttendanceRepositoryImpl _attendanceRepository;
|
|||
|
|
|||
|
public AttendanceUseCase(AttendanceRepositoryImpl attendanceRepository)
|
|||
|
{
|
|||
|
_attendanceRepository = attendanceRepository ?? throw new ArgumentNullException(nameof(attendanceRepository));
|
|||
|
}
|
|||
|
|
|||
|
public List<Attendance> GetAllAttendances()
|
|||
|
{
|
|||
|
return _attendanceRepository.GetAllAttendances() ?? new List<Attendance>();
|
|||
|
}
|
|||
|
|
|||
|
public void AddAttendance(Attendance attendance)
|
|||
|
{
|
|||
|
if (attendance == null) throw new ArgumentNullException(nameof(attendance));
|
|||
|
_attendanceRepository.AddAttendance(attendance);
|
|||
|
}
|
|||
|
|
|||
|
public bool UpdateAttendance(Attendance attendance)
|
|||
|
{
|
|||
|
if (attendance == null) throw new ArgumentNullException(nameof(attendance));
|
|||
|
return _attendanceRepository.UpdateAttendance(attendance);
|
|||
|
}
|
|||
|
|
|||
|
public bool RemoveAttendance(Guid userGuid, DateOnly date)
|
|||
|
{
|
|||
|
return _attendanceRepository.RemoveAttendance(userGuid, date);
|
|||
|
}
|
|||
|
|
|||
|
public List<Attendance> GetAttendancesByGroupAndDate(int groupId, DateOnly date)
|
|||
|
{
|
|||
|
return _attendanceRepository.GetAttendancesByGroupAndDate(groupId, date);
|
|||
|
}
|
|||
|
|
|||
|
public List<Attendance> GetAttendancesByGroupAndDateRange(int groupId, DateOnly startDate, DateOnly endDate)
|
|||
|
{
|
|||
|
return _attendanceRepository.GetAttendancesByGroupAndDateRange(groupId, startDate, endDate);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|