diff --git a/LaDOSE.Src/LaDOSE.Api/Controllers/WordPressController.cs b/LaDOSE.Src/LaDOSE.Api/Controllers/WordPressController.cs index 335fc21..fc3cb72 100644 --- a/LaDOSE.Src/LaDOSE.Api/Controllers/WordPressController.cs +++ b/LaDOSE.Src/LaDOSE.Api/Controllers/WordPressController.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using AutoMapper; using LaDOSE.Business.Interface; using LaDOSE.DTO; @@ -89,5 +91,13 @@ namespace LaDOSE.Api.Controllers { return _service.CreateChallonge(gameId, wpEventId, additionalPlayer); } + + [HttpGet("GetTournaments")] + public async Task>> GetChallonge() + { + + var game = await _service.GetTournaments(DateTime.Now.AddMonths(-2), null); + return game; + } } } \ No newline at end of file diff --git a/LaDOSE.Src/LaDOSE.Service/Interface/IChallongeProvider.cs b/LaDOSE.Src/LaDOSE.Service/Interface/IChallongeProvider.cs index ca436ad..befd03d 100644 --- a/LaDOSE.Src/LaDOSE.Service/Interface/IChallongeProvider.cs +++ b/LaDOSE.Src/LaDOSE.Service/Interface/IChallongeProvider.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using ChallongeCSharpDriver.Core.Results; @@ -10,5 +11,7 @@ namespace LaDOSE.Business.Interface string GetLastTournamentMessage(); Task CreateTournament(string name, string url); Task AddPlayer(int tournamentId, string userName); + + Task> GetTournaments(DateTime? start, DateTime? end); } } \ No newline at end of file diff --git a/LaDOSE.Src/LaDOSE.Service/Interface/IWordPressService.cs b/LaDOSE.Src/LaDOSE.Service/Interface/IWordPressService.cs index 034d726..7c3a4b5 100644 --- a/LaDOSE.Src/LaDOSE.Service/Interface/IWordPressService.cs +++ b/LaDOSE.Src/LaDOSE.Service/Interface/IWordPressService.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading.Tasks; using LaDOSE.Entity; using LaDOSE.Entity.Wordpress; @@ -15,5 +16,7 @@ namespace LaDOSE.Business.Interface string CreateChallonge(int gameId, int wpEventId, IList additionPlayers); Task GetLastChallonge(); + + Task>> GetTournaments(DateTime? start, DateTime? end); } } \ No newline at end of file diff --git a/LaDOSE.Src/LaDOSE.Service/LaDOSE.Business.csproj b/LaDOSE.Src/LaDOSE.Service/LaDOSE.Business.csproj index f9b14b9..915d27a 100644 --- a/LaDOSE.Src/LaDOSE.Service/LaDOSE.Business.csproj +++ b/LaDOSE.Src/LaDOSE.Service/LaDOSE.Business.csproj @@ -12,8 +12,7 @@ - ..\Libraries\ChallongeCSharpDriver.dll - true + ..\..\..\..\..\Project\LaDOSE\LaDOSE\Library\ChallongeCSharpDriver.dll diff --git a/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs b/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs index 30588d7..c75fc3c 100644 --- a/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs +++ b/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs @@ -45,6 +45,21 @@ namespace LaDOSE.Business.Provider } + public async Task> GetTournaments(DateTime? start, DateTime? end) + { + + List tournamentResultList = await new TournamentsQuery() + { + state = TournamentState.Ended, + createdAfter = start, + createdBefore = DateTime.Now, + + + } + .call(this.ApiCaller); + return tournamentResultList; + } + public async Task GetLastTournament() { string dernierTournois = null; diff --git a/LaDOSE.Src/LaDOSE.Service/Service/WordPressService.cs b/LaDOSE.Src/LaDOSE.Service/Service/WordPressService.cs index 2f3adae..73914bb 100644 --- a/LaDOSE.Src/LaDOSE.Service/Service/WordPressService.cs +++ b/LaDOSE.Src/LaDOSE.Service/Service/WordPressService.cs @@ -164,7 +164,13 @@ namespace LaDOSE.Business.Service var lastTournament = await _challongeProvider.GetLastTournament(); return lastTournament; } - + public async Task>> GetTournaments(DateTime? start, DateTime? end) + { + var tournamentResults = await _challongeProvider.GetTournaments(start,end); + List> ret = new List>(); + tournamentResults.ForEach(w =>ret.Add(new Tuple(w.id,w.name,w.url))); + return ret; + } private string FormatCurrentEventName(string currentEventName) { diff --git a/LaDOSE.Src/Libraries/ChallongeCSharpDriver.dll b/LaDOSE.Src/Libraries/ChallongeCSharpDriver.dll index d0b5f85..eedb508 100644 Binary files a/LaDOSE.Src/Libraries/ChallongeCSharpDriver.dll and b/LaDOSE.Src/Libraries/ChallongeCSharpDriver.dll differ