25 lines
783 B
C#
25 lines
783 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Registration.API.Services;
|
|
using Registration.Domain.Models;
|
|
|
|
namespace Registration.API.Controllers;
|
|
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class ParticipantController(IVbytesParticipantRelayService relayService) : ControllerBase
|
|
{
|
|
private readonly IVbytesParticipantRelayService _relayService = relayService;
|
|
|
|
[HttpPost("register")]
|
|
public async Task<IActionResult> RegisterForLan([FromBody] Participant participant, CancellationToken cancellationToken)
|
|
{
|
|
var result = await _relayService.RegisterParticipantAsync(participant, cancellationToken);
|
|
|
|
if (result.StatusCode == 200 && !result.Message.Contains("401"))
|
|
{
|
|
return Ok();
|
|
}
|
|
|
|
return Unauthorized();
|
|
}
|
|
}
|