slarny4/Demo1/UI/GroupConsole.cs

37 lines
1004 B
C#
Raw Normal View History

2024-11-25 04:33:26 +00:00
using Demo.Data.RemoteData.RemoteDataBase.DAO; // Используйте правильное пространство имен
2024-10-28 12:42:04 +00:00
using Demo.Domain.UseCase;
2024-11-25 04:33:26 +00:00
using System;
namespace Demo.UI
2024-10-24 08:50:32 +00:00
{
public class GroupConsole
{
private readonly GroupUseCase _groupUseCase;
public GroupConsole(GroupUseCase groupUseCase)
{
_groupUseCase = groupUseCase;
}
2024-11-25 04:33:26 +00:00
public void DisplayAllGroups()
2024-10-24 08:50:32 +00:00
{
var groups = _groupUseCase.GetAllGroups();
foreach (var group in groups)
{
2024-11-25 04:33:26 +00:00
Console.WriteLine($"ID: {group.Id}, Name: {group.Name}");
2024-10-24 08:50:32 +00:00
}
}
2024-11-25 04:33:26 +00:00
public void AddGroup(Group group)
2024-10-24 08:50:32 +00:00
{
2024-11-25 04:33:26 +00:00
_groupUseCase.AddGroup(group);
Console.WriteLine("Group added.");
2024-10-24 08:50:32 +00:00
}
2024-11-25 04:33:26 +00:00
public void UpdateGroupName(int id, string name)
2024-10-24 08:50:32 +00:00
{
2024-11-25 04:33:26 +00:00
_groupUseCase.UpdateGroupName(id, name);
Console.WriteLine("Group name updated.");
2024-10-24 08:50:32 +00:00
}
}
}