35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using data.DAO;
|
|
using data.Repository;
|
|
using domain.Request;
|
|
using domain.UseCase;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace domain.Service
|
|
{
|
|
public class GroupService : IGroupUseCase
|
|
{
|
|
private readonly IGroupRepository _groupRepository;
|
|
public GroupService(IGroupRepository groupRepository)
|
|
{
|
|
_groupRepository = groupRepository;
|
|
}
|
|
public void AddGroup(AddGroupRequest addGroupRequest)
|
|
{
|
|
_groupRepository.addGroup(new data.DAO.GroupDAO { Name = addGroupRequest.Name });
|
|
}
|
|
|
|
public void AddGroupWithStudents(AddGroupWithStudentsRequest addGroupWithStudents)
|
|
{
|
|
GroupDAO groupDAO = new GroupDAO() { Name = addGroupWithStudents.addGroupRequest.Name };
|
|
List<UserDAO> users = addGroupWithStudents.addStudentRequests
|
|
.Select(it => new UserDAO { Name = it.StudentName })
|
|
.ToList();
|
|
_groupRepository.addGroupWithStudents(groupDAO, users);
|
|
}
|
|
}
|
|
}
|