2024-10-28 12:42:04 +00:00
|
|
|
|
// C:\Users\class_Student\source\repos\slarny4\Demo1\Domain\UseCase\GroupUseCase.cs
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Demo.Data.LocalData.Entity;
|
|
|
|
|
using Demo.Data.Repository;
|
2024-10-21 22:57:01 +00:00
|
|
|
|
|
2024-10-28 12:42:04 +00:00
|
|
|
|
namespace Demo.Domain.UseCase
|
2024-10-21 22:57:01 +00:00
|
|
|
|
{
|
|
|
|
|
public class GroupUseCase
|
|
|
|
|
{
|
2024-10-24 08:50:32 +00:00
|
|
|
|
private readonly IGroupRepository _groupRepository;
|
2024-10-21 22:57:01 +00:00
|
|
|
|
|
2024-10-24 08:50:32 +00:00
|
|
|
|
public GroupUseCase(IGroupRepository groupRepository)
|
2024-10-21 22:57:01 +00:00
|
|
|
|
{
|
|
|
|
|
_groupRepository = groupRepository;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 08:50:32 +00:00
|
|
|
|
public IEnumerable<Group> GetAllGroups()
|
2024-10-23 09:52:43 +00:00
|
|
|
|
{
|
2024-10-24 08:50:32 +00:00
|
|
|
|
return _groupRepository.GetAllGroups();
|
2024-10-23 09:52:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 08:50:32 +00:00
|
|
|
|
public Group GetGroupById(int id)
|
2024-10-23 09:52:43 +00:00
|
|
|
|
{
|
2024-10-24 08:50:32 +00:00
|
|
|
|
return _groupRepository.GetGroupById(id);
|
2024-10-23 09:52:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 08:50:32 +00:00
|
|
|
|
public void AddGroup(Group group)
|
2024-10-23 09:52:43 +00:00
|
|
|
|
{
|
2024-10-24 08:50:32 +00:00
|
|
|
|
_groupRepository.AddGroup(group);
|
2024-10-23 09:52:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 08:50:32 +00:00
|
|
|
|
public void UpdateGroup(Group group)
|
2024-10-23 09:52:43 +00:00
|
|
|
|
{
|
2024-10-24 08:50:32 +00:00
|
|
|
|
_groupRepository.UpdateGroup(group);
|
2024-10-23 09:52:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 08:50:32 +00:00
|
|
|
|
public void DeleteGroup(int id)
|
2024-10-23 09:52:43 +00:00
|
|
|
|
{
|
2024-10-24 08:50:32 +00:00
|
|
|
|
_groupRepository.DeleteGroup(id);
|
2024-10-23 09:52:43 +00:00
|
|
|
|
}
|
2024-10-28 12:42:04 +00:00
|
|
|
|
|
|
|
|
|
// Дополнительные методы, если нужны
|
2024-10-21 22:57:01 +00:00
|
|
|
|
}
|
2024-10-24 08:50:32 +00:00
|
|
|
|
}
|