presence/Demo/UI/GroupConsole.cs

48 lines
1.2 KiB
C#
Raw Permalink Normal View History

2024-11-01 07:14:01 +00:00
using Demo.Data.Repository;
using Demo.domain.Models;
using Demo.Domain.Models;
using Demo.Domain.UseCase;
using System;
namespace Demo.UI
{
public class GroupConsole
{
private readonly GroupUseCase _groupUseCase;
public GroupConsole(GroupUseCase groupUseCase)
{
_groupUseCase = groupUseCase;
}
public void GetGroupById(int id)
{
_groupUseCase.GetGroupById(id);
}
public void ShowAllGroups()
{
var groups = _groupUseCase.GetAllGroups();
foreach (var group in groups)
{
Console.WriteLine($"Group ID: {group.Id}, Name: {group.Name}");
}
}
public void AddGroup(string Name)
{
GroupLocalEntity newGroup = new GroupLocalEntity { Name = Name };
_groupUseCase.AddGroup(newGroup);
Console.WriteLine("Group added successfully.");
}
public void UpdateGroup(int groupId)
{
Console.WriteLine("Enter new Group Name:");
_groupUseCase.UpdateGroup(groupId);
Console.WriteLine("Group updated successfully.");
}
}
}