2024-10-16 20:15:49 +00:00
|
|
|
using Demo.Domain.UseCase;
|
2024-10-17 12:35:14 +00:00
|
|
|
using Demo.domain.Models;
|
2024-10-16 20:15:49 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace Demo.UI
|
|
|
|
{
|
|
|
|
public class MainMenuUI
|
|
|
|
{
|
2024-10-17 12:35:14 +00:00
|
|
|
|
2024-10-16 20:15:49 +00:00
|
|
|
UserConsoleUI _userConsoleUI;
|
2024-10-17 12:35:14 +00:00
|
|
|
GroupConsoleUI _groupConsoleUI;
|
2024-10-16 20:15:49 +00:00
|
|
|
|
2024-10-17 12:35:14 +00:00
|
|
|
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase) {
|
2024-10-16 20:15:49 +00:00
|
|
|
_userConsoleUI = new UserConsoleUI(userUseCase);
|
2024-10-17 12:35:14 +00:00
|
|
|
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
|
2024-10-16 20:15:49 +00:00
|
|
|
DisplayMenu();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void DisplayMenu() {
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
switch (Console.ReadLine())
|
|
|
|
{
|
|
|
|
case "1": _userConsoleUI.DisplayAllUsers(); break;
|
|
|
|
case "2": _userConsoleUI.RemoveUserByGuid(Guid.Parse(Console.ReadLine())); break;
|
2024-10-17 12:35:14 +00:00
|
|
|
case "3": _userConsoleUI.UpdateUser(User.Parse(Console.ReadLine())); break;
|
|
|
|
case "4": _userConsoleUI.GetUserByGuid(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;
|
2024-10-16 20:15:49 +00:00
|
|
|
|
|
|
|
default: DisplayMenu();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|