Raspisanie/Zurnal/Domain/UseCase/GroupUseCase.cs

36 lines
1007 B
C#
Raw Normal View History

2024-10-23 08:14:10 +00:00
using Zurnal.Data.Repository;
using Zurnal.domain.Model;
2024-10-21 11:56:16 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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);
}
}
}