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); + } + } +}