presence/Demo/Domain/UseCase/GroupUseCase.cs
Class_Student 2971dbdac4 update
2024-11-01 10:14:01 +03:00

40 lines
997 B
C#

using Demo.Data.LocalData;
using Demo.Data.Repository;
using Demo.Domain.Models;
namespace Demo.Domain.UseCase
{
public class GroupUseCase
{
private readonly GroupRepositoryImpl _repositoryGroupImpl;
private List<GroupLocalEntity> _groups = LocalStaticData.groups;
public GroupUseCase(GroupRepositoryImpl repositoryGroupImpl)
{
_repositoryGroupImpl = repositoryGroupImpl;
}
public List<GroupLocalEntity> GetAllGroups()
{
return _repositoryGroupImpl.GetAllGroups();
}
public void GetGroupById(int id)
{
_repositoryGroupImpl.GetGroupById(id);
}
public void AddGroup(GroupLocalEntity group)
{
group.Id = _groups.Any() ? _groups.Max(g => g.Id) + 1 : 1;
_repositoryGroupImpl.AddGroup(group);
}
public void UpdateGroup(int id)
{
_repositoryGroupImpl.UpdateGroup(id);
}
}
}