presence123/Demo/UI/GroupConsole.cs
2024-10-30 12:06:35 +03:00

48 lines
1.2 KiB
C#

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.");
}
}
}