presense/Demo/UI/UserConsole.cs

29 lines
828 B
C#
Raw Normal View History

2024-10-18 13:23:16 +00:00
using System.Text;
2024-10-14 12:10:53 +00:00
namespace Demo.UI
{
public class UserConsoleUI
{
UserUseCase _userUseCase;
public UserConsoleUI(UserUseCase userUseCase) {
_userUseCase = userUseCase;
}
2024-10-16 07:01:04 +00:00
public void RemoveUserByGuid(Guid guidUser) {
string output = _userUseCase.RemoveUserByGuid(guidUser) ? "Пользователь удален" : "Пользователь не удален";
Console.WriteLine(output);
}
2024-10-14 12:10:53 +00:00
public void DisplayAllUsers()
{
StringBuilder userOutput = new StringBuilder();
2024-10-16 07:01:04 +00:00
foreach (var user in _userUseCase.GetAllUsers())
2024-10-14 12:10:53 +00:00
{
userOutput.AppendLine($"{user.Guid}\t{user.FIO}\t{user.Group.Name}");
}
Console.WriteLine(userOutput);
}
}
}