Added search options for tournament result + small test
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using LaDOSE.Business.Interface;
|
using LaDOSE.Business.Interface;
|
||||||
using LaDOSE.DTO;
|
using LaDOSE.DTO;
|
||||||
@@ -89,5 +91,13 @@ namespace LaDOSE.Api.Controllers
|
|||||||
{
|
{
|
||||||
return _service.CreateChallonge(gameId, wpEventId, additionalPlayer);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ChallongeCSharpDriver.Core.Results;
|
using ChallongeCSharpDriver.Core.Results;
|
||||||
|
|
||||||
@@ -10,5 +11,7 @@ namespace LaDOSE.Business.Interface
|
|||||||
string GetLastTournamentMessage();
|
string GetLastTournamentMessage();
|
||||||
Task<TournamentResult> CreateTournament(string name, string url);
|
Task<TournamentResult> CreateTournament(string name, string url);
|
||||||
Task<ParticipantResult> AddPlayer(int tournamentId, string userName);
|
Task<ParticipantResult> AddPlayer(int tournamentId, string userName);
|
||||||
|
|
||||||
|
Task<List<TournamentResult>> GetTournaments(DateTime? start, DateTime? end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LaDOSE.Entity;
|
using LaDOSE.Entity;
|
||||||
using LaDOSE.Entity.Wordpress;
|
using LaDOSE.Entity.Wordpress;
|
||||||
@@ -15,5 +16,7 @@ namespace LaDOSE.Business.Interface
|
|||||||
string CreateChallonge(int gameId, int wpEventId, IList<WPUser> additionPlayers);
|
string CreateChallonge(int gameId, int wpEventId, IList<WPUser> additionPlayers);
|
||||||
|
|
||||||
Task<string> GetLastChallonge();
|
Task<string> GetLastChallonge();
|
||||||
|
|
||||||
|
Task<List<Tuple<int, string, string>>> GetTournaments(DateTime? start, DateTime? end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ChallongeCSharpDriver">
|
<Reference Include="ChallongeCSharpDriver">
|
||||||
<HintPath>..\Libraries\ChallongeCSharpDriver.dll</HintPath>
|
<HintPath>..\..\..\..\..\Project\LaDOSE\LaDOSE\Library\ChallongeCSharpDriver.dll</HintPath>
|
||||||
<Private>true</Private>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,21 @@ namespace LaDOSE.Business.Provider
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<TournamentResult>> GetTournaments(DateTime? start, DateTime? end)
|
||||||
|
{
|
||||||
|
|
||||||
|
List<TournamentResult> tournamentResultList = await new TournamentsQuery()
|
||||||
|
{
|
||||||
|
state = TournamentState.Ended,
|
||||||
|
createdAfter = start,
|
||||||
|
createdBefore = DateTime.Now,
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
.call(this.ApiCaller);
|
||||||
|
return tournamentResultList;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<string> GetLastTournament()
|
public async Task<string> GetLastTournament()
|
||||||
{
|
{
|
||||||
string dernierTournois = null;
|
string dernierTournois = null;
|
||||||
|
|||||||
@@ -164,7 +164,13 @@ namespace LaDOSE.Business.Service
|
|||||||
var lastTournament = await _challongeProvider.GetLastTournament();
|
var lastTournament = await _challongeProvider.GetLastTournament();
|
||||||
return lastTournament;
|
return lastTournament;
|
||||||
}
|
}
|
||||||
|
public async Task<List<Tuple<int, string, string>>> GetTournaments(DateTime? start, DateTime? end)
|
||||||
|
{
|
||||||
|
var tournamentResults = await _challongeProvider.GetTournaments(start,end);
|
||||||
|
List<Tuple<int,string,string>> ret = new List<Tuple<int, string,string>>();
|
||||||
|
tournamentResults.ForEach(w =>ret.Add(new Tuple<int, string,string>(w.id,w.name,w.url)));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
private string FormatCurrentEventName(string currentEventName)
|
private string FormatCurrentEventName(string currentEventName)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user