Test tournament result.
This commit is contained in:
34
LaDOSE.Src/LaDOSE.Api/Controllers/TournamentController.cs
Normal file
34
LaDOSE.Src/LaDOSE.Api/Controllers/TournamentController.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LaDOSE.Business.Interface;
|
||||
using LaDOSE.DTO;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LaDOSE.Api.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Produces("application/json")]
|
||||
[Route("api/[controller]")]
|
||||
public class TournamentController : Controller
|
||||
{
|
||||
public IGameService GameService { get; }
|
||||
|
||||
private IWordPressService _service;
|
||||
// GET
|
||||
public TournamentController(IWordPressService service, IGameService gameService)
|
||||
{
|
||||
GameService = gameService;
|
||||
_service = service;
|
||||
}
|
||||
|
||||
[HttpGet("GetTournaments")]
|
||||
public async Task<List<TournamentDTO>> GetChallonges()
|
||||
{
|
||||
|
||||
var tournaments = await _service.GetTournaments(DateTime.Now.AddMonths(-2), null);
|
||||
return AutoMapper.Mapper.Map<List<TournamentDTO>>(tournaments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using LaDOSE.Business.Interface;
|
||||
using LaDOSE.DTO;
|
||||
@@ -92,12 +90,6 @@ namespace LaDOSE.Api.Controllers
|
||||
return _service.CreateChallonge(gameId, wpEventId, additionalPlayer);
|
||||
}
|
||||
|
||||
[HttpGet("GetTournaments")]
|
||||
public async Task<List<Tuple<int, string, string>>> GetChallonge()
|
||||
{
|
||||
|
||||
var game = await _service.GetTournaments(DateTime.Now.AddMonths(-2), null);
|
||||
return game;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="ChallongeCSharpDriver">
|
||||
<HintPath>..\Libraries\ChallongeCSharpDriver.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\Project\LaDOSE\LaDOSE\Library\ChallongeCSharpDriver.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
|
||||
using AutoMapper;
|
||||
using LaDOSE.Api.Helpers;
|
||||
using LaDOSE.Business.Helper;
|
||||
using LaDOSE.Entity.Challonge;
|
||||
using LaDOSE.Entity.Wordpress;
|
||||
|
||||
namespace LaDOSE.Api
|
||||
@@ -121,6 +122,8 @@ namespace LaDOSE.Api
|
||||
cfg.CreateMap<ApplicationUser, LaDOSE.DTO.ApplicationUserDTO>();
|
||||
cfg.CreateMap<WPBooking, LaDOSE.DTO.WPBookingDTO>().ForMember(e=>e.Meta,opt=>opt.MapFrom(s=>s.Meta.CleanWpMeta()));
|
||||
cfg.CreateMapTwoWay<Game, LaDOSE.DTO.GameDTO>();
|
||||
cfg.CreateMapTwoWay<Participent, LaDOSE.DTO.ParticipentDTO>();
|
||||
cfg.CreateMapTwoWay<Tournament, LaDOSE.DTO.TournamentDTO>();
|
||||
cfg.CreateMapTwoWay<Todo, LaDOSE.DTO.TodoDTO>();
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user