slarny4/Demo1/UI/UserConsole.cs

50 lines
1.3 KiB
C#

using Demo.Data.RemoteData.RemoteDataBase.DAO; // Используйте правильное пространство имен
using Demo.Domain.UseCase;
using System;
namespace Demo.UI
{
public class UserConsole
{
private readonly UserUseCase _userUseCase;
public UserConsole(UserUseCase userUseCase)
{
_userUseCase = userUseCase;
}
public void DisplayAllUsers()
{
var users = _userUseCase.GetAllUsers();
foreach (var user in users)
{
Console.WriteLine($"ID: {user.Id}, FIO: {user.FIO}, GroupID: {user.GroupID}");
}
}
public void DeleteUser(Guid id)
{
_userUseCase.DeleteUser(id);
Console.WriteLine("User deleted.");
}
public void UpdateUser(User user)
{
_userUseCase.UpdateUser(user);
Console.WriteLine("User updated.");
}
public void FindUser(Guid id)
{
var user = _userUseCase.GetUserById(id);
if (user != null)
{
Console.WriteLine($"ID: {user.Id}, FIO: {user.FIO}, GroupID: {user.GroupID}");
}
else
{
Console.WriteLine("User not found.");
}
}
}
}