using presence.data.LocalData.Entity; using presence.domain.UseCase; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace presence.ui { public class UserConsoleUI { UserUseCase _userUseCase; public UserConsoleUI(UserUseCase userUseCase) { _userUseCase = userUseCase; } public void RemoveUserById(int userId) { string output = _userUseCase.RemoveUserById(userId) ? "Пользователь удален" : "Пользователь не удален"; 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.GroupId}"); } Console.WriteLine(userOutput); } public void GetUserById(int userId) { StringBuilder userOutput = new StringBuilder(); var user = _userUseCase.GetUserById(userId); userOutput.AppendLine($"{user.Guid}\t{user.FIO}\t{user.GroupId}"); Console.WriteLine(userOutput); } public void UpdateUserById(int userId, String name, int groupId) { StringBuilder userOutput = new StringBuilder(); var user = _userUseCase.UpdateUserById(userId, name, groupId) ? "Пользователь обновлен" : "Пользователь не обновлен"; Console.WriteLine(userOutput); } } }