From 2adf9afa836f2195e7d6875eb60914f8f6544ee9 Mon Sep 17 00:00:00 2001 From: Dasha Date: Fri, 18 Oct 2024 09:47:43 +0300 Subject: [PATCH] Added get user by guid --- Domain/UseCase/UserUseCase.cs | 4 ++++ UI/MainMenu.cs | 1 + UI/UserConsole.cs | 14 ++++++++++++-- obj/Debug/net8.0/Posechaemost.AssemblyInfo.cs | 2 +- .../net8.0/Posechaemost.AssemblyInfoInputs.cache | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Domain/UseCase/UserUseCase.cs b/Domain/UseCase/UserUseCase.cs index 7441c60..95cbfda 100644 --- a/Domain/UseCase/UserUseCase.cs +++ b/Domain/UseCase/UserUseCase.cs @@ -44,5 +44,9 @@ namespace Posechaemost.Domain.UseCase if (group == null) throw new Exception(""); return new User { FIO = user.FIO, Guid = user.Guid, Group = group}; } + + public UserLocalEntity GetUserByGuid(Guid userGuid) { + return _repositoryUserImpl.GetUserByGuid(userGuid); + } } } \ No newline at end of file diff --git a/UI/MainMenu.cs b/UI/MainMenu.cs index f04977b..a55aeac 100644 --- a/UI/MainMenu.cs +++ b/UI/MainMenu.cs @@ -31,6 +31,7 @@ namespace Posechaemost.UI case "1": _userConsoleUI.DisplayAllUsers(); break; case "2": _userConsoleUI.RemoveUserByGuid(Guid.Parse(Console.ReadLine())); break; case "3": _groupConsoleUI.DisplayAllGroups(); break; + case "4": _userConsoleUI.GetUserByGuid(Guid.Parse(Console.ReadLine())); break; default: DisplayMenu(); break; diff --git a/UI/UserConsole.cs b/UI/UserConsole.cs index 008e0f3..6fe60dc 100644 --- a/UI/UserConsole.cs +++ b/UI/UserConsole.cs @@ -19,7 +19,7 @@ namespace Posechaemost.UI string output = _userUseCase.RemoveUserByGuid(guidUser) ? "Пользователь удален" : "Пользователь не удален"; Console.WriteLine(output); } - + public void DisplayAllUsers() { StringBuilder userOutput = new StringBuilder(); @@ -29,5 +29,15 @@ namespace Posechaemost.UI } Console.WriteLine(userOutput); } - } + + public void GetUserByGuid(Guid userGuid) { + StringBuilder userOutput = new StringBuilder(); + var user = _userUseCase.GetUserByGuid(userGuid); + userOutput.AppendLine($"{user.Guid}\t{user.FIO}\t{user.GroupID}"); + Console.WriteLine(userOutput); + } + } + } + + diff --git a/obj/Debug/net8.0/Posechaemost.AssemblyInfo.cs b/obj/Debug/net8.0/Posechaemost.AssemblyInfo.cs index 1f714bc..4260318 100644 --- a/obj/Debug/net8.0/Posechaemost.AssemblyInfo.cs +++ b/obj/Debug/net8.0/Posechaemost.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Posechaemost")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2043a0253af9ebde32c83e4366bb2ddff439b3bd")] [assembly: System.Reflection.AssemblyProductAttribute("Posechaemost")] [assembly: System.Reflection.AssemblyTitleAttribute("Posechaemost")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net8.0/Posechaemost.AssemblyInfoInputs.cache b/obj/Debug/net8.0/Posechaemost.AssemblyInfoInputs.cache index 9b12dfb..e10c3ff 100644 --- a/obj/Debug/net8.0/Posechaemost.AssemblyInfoInputs.cache +++ b/obj/Debug/net8.0/Posechaemost.AssemblyInfoInputs.cache @@ -1 +1 @@ -e9ceada99c48877fad5313fae59738b420d0cb46da13e0667c31a7c6ce5e0a82 +23fad0f77cb5c1fcd312e88f594bb29098487a4c55237df8836db88abd48689f