2024-10-18 06:12:15 +00:00
|
|
|
using Demo.Data.Repository;
|
|
|
|
using Demo.domain.Models;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace Demo.Domain.UseCase
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2024-10-18 06:49:19 +00:00
|
|
|
_repositoryGroupImpl.AddGroup(group: group);
|
2024-10-18 06:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void UpdateGroupName(int groupId, string newName)
|
2024-10-18 06:49:19 +00:00
|
|
|
{
|
|
|
|
_repositoryGroupImpl.UpdateGroupName(groupId, newName);
|
|
|
|
}
|
2024-10-18 06:12:15 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|