Demo/UI/GroupConsole.cs

44 lines
1.3 KiB
C#
Raw Normal View History

using Posechaemost.Domain.Models;
using Posechaemost.Domain.UseCase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Posechaemost.UI
{
public class GroupConsoleUI
{
GroupUseCase _groupUseCase;
public GroupConsoleUI(GroupUseCase groupUseCase) {
_groupUseCase = groupUseCase;
}
public void DisplayAllGroups()
{
StringBuilder groupOutput = new StringBuilder();
foreach (var group in _groupUseCase.GetAllGroups())
{
groupOutput.AppendLine($"{group.Id}\t{group.Name}");
}
Console.WriteLine(groupOutput);
}
public void UpdateGroupName(String name, String name1) {
2024-10-18 08:43:40 +00:00
StringBuilder groupOutput = new StringBuilder();
var group = _groupUseCase.UpdateGroupName(name, name1);
2024-10-18 08:43:40 +00:00
groupOutput.AppendLine($"{group.Id}\t{group.Name}");
Console.WriteLine(groupOutput);
}
public void AddGroup(String name, String id)
{
StringBuilder groupOutput = new StringBuilder();
var group = _groupUseCase.AddGroup(name, id);
groupOutput.AppendLine($"{group.Id}\t{group.Name}");
Console.WriteLine(groupOutput);
}
}
}