Raspisanie/Zurnal/Domain/UseCase/GroupUseCase.cs
2024-10-23 11:27:57 +03:00

36 lines
1008 B
C#

using Zurnal.Data.Repository;
using Zurnal.domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Zurnal.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)
{
_repositoryGroupImpl.AddGroup(group: group);
}
public void UpdateGroupName(int groupId, string newName)
{
_repositoryGroupImpl.UpdateGroupName(groupId, newName);
}
}
}