This commit is contained in:
adm 2024-10-14 15:10:53 +03:00
parent 0b9580781c
commit e1ec08575e
3 changed files with 50 additions and 12 deletions

View File

@ -1,20 +1,10 @@
 
using Demo.Data.Repository; using Demo.Data.Repository;
using Demo.domain.Models;
using Demo.Domain.UseCase; using Demo.Domain.UseCase;
using Demo.UI;
GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl(); GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl();
UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl(); UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl();
UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl); UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl);
List<User> users = userUseCase.GetAllUsers; MainMenuUI mainMenuUI = new MainMenuUI(userUseCase);
foreach (var user in users) {
Console.WriteLine($"{user.FIO} группа {user.Group.Name}");
}
userUseCase.
Console.ReadKey();

21
Demo/UI/MainMenu.cs Normal file
View File

@ -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();
}
}
}

27
Demo/UI/UserConsole.cs Normal file
View File

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