Test Connection
Add Todo Bot use Webservice now TBD : Rework Event
This commit is contained in:
@@ -6,7 +6,7 @@ namespace LaDOSE.Business.Interface
|
||||
{
|
||||
public interface IChallongeProvider
|
||||
{
|
||||
Task<Boolean> GetLastTournament();
|
||||
Task<string> GetLastTournament();
|
||||
string GetLastTournamentMessage();
|
||||
Task<TournamentResult> CreateTournament(string name, string url);
|
||||
Task<ParticipantResult> AddPlayer(int tournamentId, string userName);
|
||||
|
||||
9
LaDOSE.Src/LaDOSE.Service/Interface/ITodoService.cs
Normal file
9
LaDOSE.Src/LaDOSE.Service/Interface/ITodoService.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using LaDOSE.Entity;
|
||||
|
||||
namespace LaDOSE.Business.Interface
|
||||
{
|
||||
public interface ITodoService : IBaseService<Todo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LaDOSE.Entity;
|
||||
using LaDOSE.Entity.Wordpress;
|
||||
|
||||
@@ -12,5 +13,7 @@ namespace LaDOSE.Business.Interface
|
||||
List<WPUser> GetBookingOptions(int wpEventId, Game game);
|
||||
bool UpdateBooking();
|
||||
string CreateChallonge(int gameId, int wpEventId, IList<WPUser> additionPlayers);
|
||||
|
||||
Task<string> GetLastChallonge();
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,9 @@ namespace LaDOSE.Business.Provider
|
||||
|
||||
}
|
||||
|
||||
public async Task<Boolean> GetLastTournament()
|
||||
public async Task<string> GetLastTournament()
|
||||
{
|
||||
string dernierTournois = null;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -59,6 +60,7 @@ namespace LaDOSE.Business.Provider
|
||||
|
||||
|
||||
var lastDate = tournamentResultList.Max(e => e.completed_at);
|
||||
|
||||
if (lastDate.HasValue)
|
||||
{
|
||||
var lastRankingDate = new DateTime(lastDate.Value.Year, lastDate.Value.Month, lastDate.Value.Day);
|
||||
@@ -70,13 +72,13 @@ namespace LaDOSE.Business.Provider
|
||||
returnValue += $"{tournamentResult.name} : <https://challonge.com/{tournamentResult.url}> \n";
|
||||
}
|
||||
|
||||
DernierTournois = returnValue;
|
||||
dernierTournois = returnValue;
|
||||
}
|
||||
return true;
|
||||
return dernierTournois;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
return dernierTournois;
|
||||
}
|
||||
}
|
||||
public string GetLastTournamentMessage()
|
||||
|
||||
30
LaDOSE.Src/LaDOSE.Service/Service/TodoService.cs
Normal file
30
LaDOSE.Src/LaDOSE.Service/Service/TodoService.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LaDOSE.Business.Interface;
|
||||
using LaDOSE.Entity;
|
||||
using LaDOSE.Entity.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LaDOSE.Business.Service
|
||||
{
|
||||
public class TodoService : BaseService<Todo>, ITodoService
|
||||
{
|
||||
public TodoService(LaDOSEDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Delete(int id)
|
||||
{
|
||||
var find = _context.Find<Todo>(id);
|
||||
find.Deleted = DateTime.Now;
|
||||
this._context.SaveChanges();
|
||||
return _context.Entry(find).State == EntityState.Modified;
|
||||
}
|
||||
|
||||
public override IEnumerable<Todo> GetAll()
|
||||
{
|
||||
return _context.Set<Todo>().Where(e=>e.Deleted == null).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ChallongeCSharpDriver;
|
||||
using ChallongeCSharpDriver.Core.Queries;
|
||||
using ChallongeCSharpDriver.Core.Results;
|
||||
using LaDOSE.Business.Helper;
|
||||
using LaDOSE.Business.Interface;
|
||||
using LaDOSE.Entity;
|
||||
@@ -154,6 +159,12 @@ namespace LaDOSE.Business.Service
|
||||
return "error while creating challonge";
|
||||
}
|
||||
|
||||
public async Task<string> GetLastChallonge()
|
||||
{
|
||||
var lastTournament = await _challongeProvider.GetLastTournament();
|
||||
return lastTournament;
|
||||
}
|
||||
|
||||
private string FormatCurrentEventName(string currentEventName)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user