55 lines
2.0 KiB
C#
55 lines
2.0 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.UI
|
|||
|
{
|
|||
|
public class GroupUI
|
|||
|
{
|
|||
|
private readonly IGroupUseCase _groupService;
|
|||
|
|
|||
|
public GroupUI(IGroupUseCase groupService)
|
|||
|
{
|
|||
|
_groupService = groupService;
|
|||
|
}
|
|||
|
|
|||
|
public void AddGroup()
|
|||
|
{
|
|||
|
Console.Write("Введите имя группы: ");
|
|||
|
_groupService.AddGroup(new AddGroupRequest { Name = Console.ReadLine() });
|
|||
|
}
|
|||
|
|
|||
|
public void AddGroupWithStudents()
|
|||
|
{
|
|||
|
Console.Write("Введите имя группы: ");
|
|||
|
AddGroupRequest addGroupRequest = new AddGroupRequest { Name = Console.ReadLine() };
|
|||
|
List<AddStudentRequest> addStudentRequests = new List<AddStudentRequest>()
|
|||
|
{
|
|||
|
new AddStudentRequest {FirstName = "Имя", LastName = "Фамилия", Patronymic = "Отчество"},
|
|||
|
new AddStudentRequest {FirstName = "Imya", LastName = "Familiya", Patronymic = "Otchestvo"},
|
|||
|
new AddStudentRequest {FirstName = "FirstName", LastName = "LastName", Patronymic = "Patronymic"},
|
|||
|
new AddStudentRequest {FirstName = "1", LastName = "2", Patronymic = "3"},
|
|||
|
};
|
|||
|
AddGroupWithStudentRequest addGroupWithStudentRequest = new()
|
|||
|
{
|
|||
|
AddGroupRequest = addGroupRequest,
|
|||
|
AddStudentRequests = addStudentRequests
|
|||
|
};
|
|||
|
|
|||
|
_groupService.AddGroupWithStudents(addGroupWithStudentRequest);
|
|||
|
}
|
|||
|
|
|||
|
public void RemoveGroup()
|
|||
|
{
|
|||
|
Console.Write("Введите индетефикатор группы: ");
|
|||
|
RemoveGroupRequest removeGroupRequest = new RemoveGroupRequest { GroupId = int.Parse(Console.ReadLine()) };
|
|||
|
_groupService.RemoveGroup(removeGroupRequest);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|