presence/Presence.API/Controllers/AdminController.cs

38 lines
1.1 KiB
C#
Raw Normal View History

2024-12-05 07:31:49 +00:00
using domain.UseCase;
using domain.Request;
using Microsoft.AspNetCore.Mvc;
2024-12-04 12:21:15 +00:00
namespace Presence.API.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class AdminController : ControllerBase
{
2024-12-05 07:31:49 +00:00
private readonly IAdminUseCase _adminUseCase;
public AdminController(IAdminUseCase adminUseCase)
{
_adminUseCase = adminUseCase;
}
[HttpPost("/group/{groupId}/students")]
public IActionResult AddStudentsToGroup(int groupId, [FromBody] AddStudentsToGroupRequest request)
{
if (request?.Students == null)
return BadRequest();
_adminUseCase.AddStudentsToGroup(groupId, request);
return NoContent();
}
[HttpPost("/group/{groupId}/subjects")]
public IActionResult AddSubjectsToGroup(int groupId, [FromBody] AddSubjectsToGroupRequest request)
{
if (request?.Subjects == null)
return BadRequest();
_adminUseCase.AddSubjectsToGroup(groupId, request);
return NoContent();
}
2024-12-04 12:21:15 +00:00
}
2024-12-05 07:31:49 +00:00
}