Demo/UI/MainMenu.cs

48 lines
1.5 KiB
C#
Raw Permalink Normal View History

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;
2024-10-18 06:47:43 +00:00
case "4": _userConsoleUI.GetUserByGuid(Guid.Parse(Console.ReadLine())); break;
case "5": _userConsoleUI.UpdateUserByGuid(Guid.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine()); break;
case "6": _groupConsoleUI.UpdateGroupName(Console.ReadLine(), Console.ReadLine()); break;
2024-10-18 08:43:40 +00:00
case "7": _groupConsoleUI.AddGroup(Console.ReadLine(), Console.ReadLine()); break;
default: DisplayMenu();
break;
}
}
}
}
}