2024-10-23 08:39:09 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
using Zurnal.Domain.UseCase;
|
2024-10-21 11:56:16 +00:00
|
|
|
|
|
2024-10-23 08:39:09 +00:00
|
|
|
|
namespace Zurnal.UI
|
2024-10-21 11:56:16 +00:00
|
|
|
|
{
|
|
|
|
|
public class UserConsoleUI
|
|
|
|
|
{
|
|
|
|
|
UserUseCase _userUseCase;
|
|
|
|
|
public UserConsoleUI(UserUseCase userUseCase)
|
|
|
|
|
{
|
|
|
|
|
_userUseCase = userUseCase;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveUserByGuid(Guid guidUser)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string output = _userUseCase.RemoveUserByGuid(guidUser) ? "Пользователь удален" : "Пользователь не удален";
|
|
|
|
|
Console.WriteLine(output);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DisplayAllUsers()
|
|
|
|
|
{
|
|
|
|
|
StringBuilder userOutput = new StringBuilder();
|
|
|
|
|
foreach (var user in _userUseCase.GetAllUsers())
|
|
|
|
|
{
|
|
|
|
|
userOutput.AppendLine($"{user.Guid}\t{user.FIO}\t{user.Group.Name}");
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine(userOutput);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|