2024-11-02 09:07:18 +00:00
|
|
|
|
using System.Text.RegularExpressions;
|
2024-10-23 08:14:10 +00:00
|
|
|
|
using Zurnal.Data.Repository;
|
2024-11-02 09:07:18 +00:00
|
|
|
|
using Zurnal.Date.Repository;
|
|
|
|
|
using Zurnal.RemaDateBase.DateDao;
|
2024-10-23 08:14:10 +00:00
|
|
|
|
namespace Zurnal.Domain.UseCase
|
2024-10-21 11:56:16 +00:00
|
|
|
|
{
|
2024-11-02 09:07:18 +00:00
|
|
|
|
public class GroupUseCase : IGroupRepository
|
2024-10-21 11:56:16 +00:00
|
|
|
|
{
|
|
|
|
|
private UserRepositoryImpl _repositoryUserImpl;
|
|
|
|
|
private GroupRepositoryImpl _repositoryGroupImpl;
|
|
|
|
|
|
2024-11-02 09:07:18 +00:00
|
|
|
|
public List<GroupDao> AllGroup => throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<GroupDao> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
|
|
|
|
|
.Select(it => new GroupDao { Id = it.Id, GroupName = it.GroupName }).ToList();
|
2024-10-21 11:56:16 +00:00
|
|
|
|
|
|
|
|
|
public GroupUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
|
|
|
|
|
{
|
|
|
|
|
_repositoryUserImpl = repositoryImpl;
|
|
|
|
|
_repositoryGroupImpl = repositoryGroupImpl;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-02 09:07:18 +00:00
|
|
|
|
public void AddGroup(GroupDao group)
|
2024-10-21 11:56:16 +00:00
|
|
|
|
{
|
|
|
|
|
_repositoryGroupImpl.AddGroup(group: group);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateGroupName(int groupId, string newName)
|
|
|
|
|
{
|
|
|
|
|
_repositoryGroupImpl.UpdateGroupName(groupId, newName);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-02 09:07:18 +00:00
|
|
|
|
public IEnumerable<GroupDao> AllGroups()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool RemoveGroupById(int groupID)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool UpdateGroupById(int groupID, GroupDao updatedGroup)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerable<GroupDao> IGroupRepository.GetAllGroups()
|
|
|
|
|
{
|
|
|
|
|
return _repositoryGroupImpl.GetAllGroups()
|
|
|
|
|
.Select(it => new GroupDao { Id = it.Id, GroupName = it.GroupName, Users = it.Users })
|
|
|
|
|
.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddGroupFromRegex(System.Text.RegularExpressions.Group group)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GroupDao GetGroupById(int id)
|
|
|
|
|
{
|
|
|
|
|
var group = _repositoryGroupImpl.GetGroupById(id);
|
|
|
|
|
if (group == null)
|
|
|
|
|
{
|
|
|
|
|
throw new KeyNotFoundException($"Группа с ID {id} не найдена.");
|
|
|
|
|
}
|
|
|
|
|
return group;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateGroup(GroupDao group)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DeleteGroup(int id)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerable<Group> IGroupRepository.AllGroups()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IGroupRepository.AddGroup(GroupDao newGroup)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2024-10-21 11:56:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|