pr1/presence/console_ui/GroupUI.cs
2024-12-05 12:30:01 +03:00

44 lines
1.5 KiB
C#

using domain.Request;
using domain.Service;
using domain.UseCase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace console_ui
{
class GroupUI
{
private readonly IGroupUseCase _groupService;
public GroupUI(IGroupUseCase groupService)
{
_groupService = groupService;
}
public void AddGroup()
{
Console.WriteLine("Введите имя группы");
_groupService.AddGroup(new AddGroupRequest { Name = Console.ReadLine() });
}
public void AddGroupWithStudents()
{
Console.WriteLine("Введите имя группы");
AddGroupRequest addGroupRequest = new AddGroupRequest { Name = Console.ReadLine() };
List<AddStudentRequest> addStudentRequests = new List<AddStudentRequest>() {
new AddStudentRequest{StudentName = "123" },
new AddStudentRequest{StudentName = "312" },
new AddStudentRequest{StudentName = "222" },
new AddStudentRequest{StudentName = "444" },
};
AddGroupWithStudentsRequest addGroupWithStudents = new AddGroupWithStudentsRequest
{
addGroupRequest = addGroupRequest,
AddStudentRequests = addStudentRequests
};
_groupService.AddGroupWithSutdents(addGroupWithStudents);
}
}
}