2024-10-23 08:14:10 +00:00
|
|
|
using Zurnal.Data.Repository;
|
2024-10-23 08:27:57 +00:00
|
|
|
using Zurnal.domain.Models;
|
2024-10-23 08:14:10 +00:00
|
|
|
namespace Zurnal.Domain.UseCase
|
2024-10-21 11:56:16 +00:00
|
|
|
{
|
|
|
|
public class GroupUseCase
|
|
|
|
{
|
|
|
|
private UserRepositoryImpl _repositoryUserImpl;
|
|
|
|
private GroupRepositoryImpl _repositoryGroupImpl;
|
|
|
|
|
|
|
|
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
|
|
|
|
.Select(it => new Group { Id = it.Id, Name = it.Name }).ToList();
|
|
|
|
|
|
|
|
public GroupUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
|
|
|
|
{
|
|
|
|
_repositoryUserImpl = repositoryImpl;
|
|
|
|
_repositoryGroupImpl = repositoryGroupImpl;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AddGroup(Group group)
|
|
|
|
{
|
|
|
|
_repositoryGroupImpl.AddGroup(group: group);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UpdateGroupName(int groupId, string newName)
|
|
|
|
{
|
|
|
|
_repositoryGroupImpl.UpdateGroupName(groupId, newName);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|