presence123/Demo/Domain/UseCase/GroupUseCase.cs

40 lines
997 B
C#
Raw Normal View History

2024-10-30 09:06:35 +00:00
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);
}
}
}