39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using Demo.Domain.Models;
|
|
using Demo.Domain.UseCase;
|
|
|
|
namespace Demo.UI
|
|
{
|
|
public class MainMenuUI
|
|
{
|
|
|
|
UserConsoleUI _userConsoleUI;
|
|
GroupConsoleUI _groupConsoleUI;
|
|
|
|
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase) {
|
|
_userConsoleUI = new UserConsoleUI(userUseCase);
|
|
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
|
|
DisplayMenu();
|
|
|
|
}
|
|
|
|
private void DisplayMenu() {
|
|
while (true)
|
|
{
|
|
switch (Console.ReadLine())
|
|
{
|
|
case "1": _userConsoleUI.DisplayAllUsers(); break;
|
|
case "2": _userConsoleUI.RemoveUserByGuid(Guid.Parse(Console.ReadLine())); break;
|
|
case "3": _userConsoleUI.UpdateUserByGuid(User.Parse(Console.ReadLine())); break;
|
|
case "4": _userConsoleUI.DisplayUserByGuid(Guid.Parse(Console.ReadLine())); break;
|
|
case "5": _groupConsoleUI.DisplayAllGroups(); break;
|
|
case "6": _groupConsoleUI.CreateNewGroup(Group.Parse(Console.ReadLine())); break;
|
|
case "7": _groupConsoleUI.UpdateGroupName(Group.Parse(Console.ReadLine())); break; //todo
|
|
|
|
default: DisplayMenu();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
} |