semesterWork/console_ui/GroupUI.cs

46 lines
1.5 KiB
C#
Raw Normal View History

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("Enter group name: ");
_groupService.AddGroup(new domain.Request.AddGroupRequest { Name = Console.ReadLine() });
}
public void AddGroupWithStudents()
{
Console.WriteLine("Enter group name: ");
AddGroupRequest addGroupRequest = new AddGroupRequest { Name = Console.ReadLine() };
List<AddStudentRequest> addStudentRequests = new List<AddStudentRequest>()
{
new AddStudentRequest{ StudentName = "StudentName1"},
new AddStudentRequest{ StudentName = "StudentName2"},
new AddStudentRequest{ StudentName = "StudentName3"},
new AddStudentRequest{ StudentName = "StudentName4"},
};
AddGroupWithStudentsRequest addGroupWithStudents = new AddGroupWithStudentsRequest
{
addGroupRequest = addGroupRequest,
addStudentRequests = addStudentRequests
};
_groupService.AddGroupWithStudents(addGroupWithStudents);
}
}
}