presence/Demo/UI/GroupConsole.cs
2024-10-18 14:46:21 +03:00

44 lines
1.1 KiB
C#

using Demo.Domain.UseCase;
using System;
namespace Demo.UI
{
public class GroupConsole
{
private readonly GroupUseCase _groupUseCase;
public GroupConsole(GroupUseCase groupUseCase)
{
_groupUseCase = groupUseCase;
}
public void ShowAllGroups()
{
var groups = _groupUseCase.GetAllGroups();
foreach (var group in groups)
{
Console.WriteLine($"Group ID: {group.Id}, Name: {group.Name}");
}
}
public void AddGroup()
{
Console.WriteLine("Enter Group Name:");
string name = Console.ReadLine();
var id = int.Parse(Console.ReadLine());
_groupUseCase.AddGroup(id, name);
Console.WriteLine("Group added successfully.");
}
public void UpdateGroup(int groupId)
{
Console.WriteLine("Enter new Group Name:");
string newName = Console.ReadLine();
_groupUseCase.UpdateGroup(groupId, newName);
Console.WriteLine("Group updated successfully.");
}
}
}