Demo/UI/MainMenu.cs

44 lines
1.1 KiB
C#

using Posechaemost.Domain.UseCase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Posechaemost.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": _groupConsoleUI.DisplayAllGroups(); break;
default: DisplayMenu();
break;
}
}
}
}
}