Files
LaDOSE/LaDOSE.Src/LaDOSE.Api/Controllers/SmashController.cs
Darkstack aebc60d17f Smash test
test debug

Result

Disctinct by selector
Refactoring Smash/Challonge

Test Resultat

Html for Kiouze
2022-03-19 23:05:13 +01:00

63 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using LaDOSE.Business.Interface;
using LaDOSE.DTO;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
#if DEBUG
[AllowAnonymous]
#endif
[Produces("application/json")]
[Route("api/[controller]")]
public class SmashController : Controller
{
private ITournamentService _service;
private IMapper _mapper;
// GET
public SmashController(IMapper mapper, ITournamentService service)
{
_mapper = mapper;
_service = service;
}
//This may be a get , but i dont know what the RFC State for Get request with Body
//As i don't like to populate GET request with body this will be a post (and i think
//it will be easier to proxy.
[HttpGet("GetTournament/{tournamentSlug}")]
public async Task<IActionResult> GetSmashTournament(string tournamentSlug)
{
if (!String.IsNullOrEmpty(tournamentSlug))
{
var tournaments = await _service.GetSmashResult(tournamentSlug);
return Ok(tournaments);
}
return null;
}
//[HttpPost("GetResults")]
//public async Task<TournamentsResultDTO> GetResults([FromBody] List<int> ids)
//{
// if (ids == null)
// {
// throw new Exception("Invalid arguments");
// }
// var tournamentsResult = await _service.GetTournamentsResult(ids);
// return _mapper.Map<TournamentsResultDTO>(tournamentsResult);
//}
}
}