Generate Challonge
This commit is contained in:
@@ -8,7 +8,8 @@ namespace LaDOSE.Entity.Context
|
||||
public DbSet<ApplicationUser> ApplicationUser { get; set; }
|
||||
public DbSet<Season> Season { get; set; }
|
||||
public DbSet<Event> Event { get; set; }
|
||||
//public DbSet<SeasonGame> SeasonGame { get; set; }
|
||||
public DbSet<SeasonGame> SeasonGame { get; set; }
|
||||
public DbSet<EventGame> EventGame { get; set; }
|
||||
|
||||
public LaDOSEDbContext(DbContextOptions options) : base(options)
|
||||
{
|
||||
|
||||
@@ -8,5 +8,7 @@
|
||||
public int GameId { get; set; }
|
||||
public Game Game { get; set; }
|
||||
|
||||
public int? ChallongeId { get; set; }
|
||||
public string ChallongeUrl { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ChallongeCSharpDriver.Core.Results;
|
||||
|
||||
namespace LaDOSE.Business.Interface
|
||||
{
|
||||
@@ -7,6 +8,6 @@ namespace LaDOSE.Business.Interface
|
||||
{
|
||||
Task<Boolean> GetLastTournament();
|
||||
string GetLastTournamentMessage();
|
||||
Task<Tuple<int, string>> CreateTournament(string name, string url);
|
||||
Task<TournamentResult> CreateTournament(string name, string url);
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,10 @@ namespace LaDOSE.Business.Provider
|
||||
DernierTournois = "Aucun tournois.";
|
||||
}
|
||||
|
||||
public async Task<Tuple<int, string>> CreateTournament(string name, string url)
|
||||
public async Task<TournamentResult> CreateTournament(string name, string url)
|
||||
{
|
||||
var p = await new CreateTournamentQuery(name, TournamentType.Double_Elimination, url).call(ApiCaller);
|
||||
return new Tuple<int, string>(p.id, p.url);
|
||||
var result = await new CreateTournamentQuery(name, TournamentType.Double_Elimination, url).call(ApiCaller);
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -44,9 +44,15 @@ namespace LaDOSE.Business.Service
|
||||
{
|
||||
var url = $"TestDev{game.Id}{game.Name}";
|
||||
var name = $"[{s}]Ranking {currentEvent.Name}{game.Name}";
|
||||
_challongeProvider.CreateTournament(name,url);
|
||||
var tournament = _challongeProvider.CreateTournament(name,url).Result;
|
||||
var eventGame = currentEvent.Games.FirstOrDefault(e => e.GameId == game.Id);
|
||||
eventGame.ChallongeId = tournament.id;
|
||||
eventGame.ChallongeUrl = tournament.url;
|
||||
_context.Entry(eventGame).State = EntityState.Modified;
|
||||
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user