From e1ec08575e6b266f542a7af4c951c0d7a841ce38 Mon Sep 17 00:00:00 2001 From: adm Date: Mon, 14 Oct 2024 15:10:53 +0300 Subject: [PATCH] add ui --- Demo/Program.cs | 14 ++------------ Demo/UI/MainMenu.cs | 21 +++++++++++++++++++++ Demo/UI/UserConsole.cs | 27 +++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 Demo/UI/MainMenu.cs create mode 100644 Demo/UI/UserConsole.cs diff --git a/Demo/Program.cs b/Demo/Program.cs index da2898d..9ebb621 100644 --- a/Demo/Program.cs +++ b/Demo/Program.cs @@ -1,20 +1,10 @@  - using Demo.Data.Repository; -using Demo.domain.Models; using Demo.Domain.UseCase; +using Demo.UI; GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl(); UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl(); UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl); -List users = userUseCase.GetAllUsers; - -foreach (var user in users) { - Console.WriteLine($"{user.FIO} группа {user.Group.Name}"); -} - -userUseCase. - - -Console.ReadKey(); \ No newline at end of file +MainMenuUI mainMenuUI = new MainMenuUI(userUseCase); \ No newline at end of file diff --git a/Demo/UI/MainMenu.cs b/Demo/UI/MainMenu.cs new file mode 100644 index 0000000..f93611a --- /dev/null +++ b/Demo/UI/MainMenu.cs @@ -0,0 +1,21 @@ +using Demo.Domain.UseCase; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo.UI +{ + public class MainMenuUI + { + + UserConsoleUI _userConsoleUI; + + public MainMenuUI(UserUseCase userUseCase) { + _userConsoleUI = new UserConsoleUI(userUseCase); + _userConsoleUI.DisplayAllUsers(); + } + + } +} diff --git a/Demo/UI/UserConsole.cs b/Demo/UI/UserConsole.cs new file mode 100644 index 0000000..81aadda --- /dev/null +++ b/Demo/UI/UserConsole.cs @@ -0,0 +1,27 @@ +using Demo.Domain.UseCase; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo.UI +{ + public class UserConsoleUI + { + UserUseCase _userUseCase; + public UserConsoleUI(UserUseCase userUseCase) { + _userUseCase = userUseCase; + } + + 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); + } + } +}