Commit Debut de rework
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
using LaDOSE.Business.Interface;
|
|
||||||
using LaDOSE.Business.Service;
|
|
||||||
using LaDOSE.Entity;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace LaDOSE.Api.Controllers
|
|
||||||
{
|
|
||||||
[Authorize]
|
|
||||||
[Route("api/[controller]")]
|
|
||||||
[Produces("application/json")]
|
|
||||||
public class SeasonController : GenericController<ISeasonService,Season>
|
|
||||||
{
|
|
||||||
public SeasonController(ISeasonService service) : base(service)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,18 +44,6 @@ namespace LaDOSE.Api.Controllers
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//[HttpPost("GetResults")]
|
|
||||||
//public async Task<TournamentsResultDTO> GetResults([FromBody] List<int> ids)
|
|
||||||
//{
|
|
||||||
// if (ids == null)
|
|
||||||
// {
|
|
||||||
// throw new Exception("Invalid arguments");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var tournamentsResult = await _service.GetTournamentsResult(ids);
|
|
||||||
// return _mapper.Map<TournamentsResultDTO>(tournamentsResult);
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ using LaDOSE.Business.Provider.ChallongProvider;
|
|||||||
using LaDOSE.Business.Provider.SmashProvider;
|
using LaDOSE.Business.Provider.SmashProvider;
|
||||||
using LaDOSE.Entity.Challonge;
|
using LaDOSE.Entity.Challonge;
|
||||||
using LaDOSE.Entity.Wordpress;
|
using LaDOSE.Entity.Wordpress;
|
||||||
|
using Result = LaDOSE.Entity.Challonge.Result;
|
||||||
|
|
||||||
namespace LaDOSE.Api
|
namespace LaDOSE.Api
|
||||||
{
|
{
|
||||||
@@ -146,7 +147,6 @@ namespace LaDOSE.Api
|
|||||||
services.AddScoped<IUserService, UserService>();
|
services.AddScoped<IUserService, UserService>();
|
||||||
services.AddScoped<IGameService, GameService>();
|
services.AddScoped<IGameService, GameService>();
|
||||||
services.AddScoped<IEventService, EventService>();
|
services.AddScoped<IEventService, EventService>();
|
||||||
services.AddScoped<ISeasonService, SeasonService>();
|
|
||||||
services.AddScoped<IWordPressService, WordPressService>();
|
services.AddScoped<IWordPressService, WordPressService>();
|
||||||
services.AddScoped<ITodoService, TodoService>();
|
services.AddScoped<ITodoService, TodoService>();
|
||||||
services.AddScoped<ITournamentService, TournamentService>();
|
services.AddScoped<ITournamentService, TournamentService>();
|
||||||
|
|||||||
@@ -21,12 +21,13 @@ namespace LaDOSE.DesktopApp
|
|||||||
|
|
||||||
MessageBox.Show("WAITING IN DEBUG MODE");
|
MessageBox.Show("WAITING IN DEBUG MODE");
|
||||||
#endif
|
#endif
|
||||||
base.OnStartup(e);
|
|
||||||
|
|
||||||
|
|
||||||
var settings = new CefSettings();
|
var settings = new CefSettings();
|
||||||
settings.SetOffScreenRenderingBestPerformanceArgs();
|
settings.SetOffScreenRenderingBestPerformanceArgs();
|
||||||
Cef.Initialize(settings);
|
Cef.Initialize(settings);
|
||||||
|
base.OnStartup(e);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace LaDOSE.DesktopApp
|
|||||||
|
|
||||||
container.Singleton<IWindowManager, WindowManager>();
|
container.Singleton<IWindowManager, WindowManager>();
|
||||||
container.Singleton<RestService>();
|
container.Singleton<RestService>();
|
||||||
|
|
||||||
container.PerRequest<ShellViewModel>();
|
container.PerRequest<ShellViewModel>();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,9 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
restService.UpdatedJwtEvent += TokenUpdate;
|
restService.UpdatedJwtEvent += TokenUpdate;
|
||||||
restService.Connect(uri, user, password);
|
restService.Connect(uri, user, password);
|
||||||
|
|
||||||
base.OnInitialize();
|
|
||||||
|
|
||||||
|
base.OnInitialize();
|
||||||
|
ActivateItem(new TournamentResultViewModel(IoC.Get<RestService>()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -344,6 +344,12 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
int columns = 0;
|
int columns = 0;
|
||||||
foreach (var game in Results.Games)
|
foreach (var game in Results.Games)
|
||||||
{
|
{
|
||||||
|
List<ResultDTO> enumerable = Results.Results.Where(r => r.GameId == game.Id).ToList();
|
||||||
|
List<string> top3 = enumerable.OrderBy(e => e.Rank).Take(3).Select(e => e.Player).ToList();
|
||||||
|
if (top3.Count == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (columns % 2 == 0)
|
if (columns % 2 == 0)
|
||||||
{
|
{
|
||||||
@@ -354,8 +360,7 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
"<span style=\"color: #ff0000;\">" +
|
"<span style=\"color: #ff0000;\">" +
|
||||||
$"<strong>{game.LongName} ({Results.Results.Count(e => e.GameId == game.Id)} participants) :</strong>" +
|
$"<strong>{game.LongName} ({Results.Results.Count(e => e.GameId == game.Id)} participants) :</strong>" +
|
||||||
"</span>");
|
"</span>");
|
||||||
List<ResultDTO> enumerable = Results.Results.Where(r => r.GameId == game.Id).ToList();
|
|
||||||
List<string> top3 = enumerable.OrderBy(e => e.Rank).Take(3).Select(e => e.Player).ToList();
|
|
||||||
if (top3.Count >= 3)
|
if (top3.Count >= 3)
|
||||||
{
|
{
|
||||||
sb.AppendLine($"<br> 1/ {top3[0]}<br> 2/ {top3[1]}<br> 3/ {top3[2]} <br>");
|
sb.AppendLine($"<br> 1/ {top3[0]}<br> 2/ {top3[1]}<br> 3/ {top3[2]} <br>");
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using LaDOSE.Entity.Challonge;
|
using LaDOSE.Entity.Challonge;
|
||||||
|
|
||||||
using LaDOSE.Entity.Wordpress;
|
using LaDOSE.Entity.Wordpress;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -8,8 +9,7 @@ namespace LaDOSE.Entity.Context
|
|||||||
{
|
{
|
||||||
public DbSet<Game> Game { get; set; }
|
public DbSet<Game> Game { get; set; }
|
||||||
public DbSet<ApplicationUser> ApplicationUser { get; set; }
|
public DbSet<ApplicationUser> ApplicationUser { get; set; }
|
||||||
public DbSet<Season> Season { get; set; }
|
|
||||||
public DbSet<Event> Event { get; set; }
|
|
||||||
public DbSet<Todo> Todo { get; set; }
|
public DbSet<Todo> Todo { get; set; }
|
||||||
|
|
||||||
#region WordPress
|
#region WordPress
|
||||||
@@ -19,8 +19,15 @@ namespace LaDOSE.Entity.Context
|
|||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public DbSet<SeasonGame> SeasonGame { get; set; }
|
|
||||||
public DbSet<EventGame> EventGame { get; set; }
|
|
||||||
|
#region Tournament
|
||||||
|
public DbSet<Player> Player { get; set; }
|
||||||
|
public DbSet<Event> Event { get; set; }
|
||||||
|
public DbSet<Tournament> Tournament { get; set; }
|
||||||
|
public DbSet<Result> Result { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
|
public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
|
||||||
public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
|
public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
|
||||||
|
|
||||||
@@ -36,43 +43,43 @@ namespace LaDOSE.Entity.Context
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
modelBuilder.Entity<Event>()
|
//modelBuilder.Entity<Event>()
|
||||||
.HasOne(s => s.Season)
|
// .HasOne(s => s.Season)
|
||||||
.WithMany(p => p.Event)
|
// .WithMany(p => p.Event)
|
||||||
.HasForeignKey(fk => fk.SeasonId);
|
// .HasForeignKey(fk => fk.SeasonId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region SeasonGame
|
//#region SeasonGame
|
||||||
modelBuilder.Entity<SeasonGame>()
|
//modelBuilder.Entity<SeasonGame>()
|
||||||
.HasKey(t => new { t.SeasonId, t.GameId });
|
// .HasKey(t => new { t.SeasonId, t.GameId });
|
||||||
|
|
||||||
modelBuilder.Entity<SeasonGame>()
|
//modelBuilder.Entity<SeasonGame>()
|
||||||
.HasOne(pt => pt.Season)
|
// .HasOne(pt => pt.Season)
|
||||||
.WithMany(p => p.Games)
|
// .WithMany(p => p.Games)
|
||||||
.HasForeignKey(pt => pt.SeasonId);
|
// .HasForeignKey(pt => pt.SeasonId);
|
||||||
|
|
||||||
modelBuilder.Entity<SeasonGame>()
|
//modelBuilder.Entity<SeasonGame>()
|
||||||
.HasOne(pt => pt.Game)
|
// .HasOne(pt => pt.Game)
|
||||||
.WithMany(p => p.Seasons)
|
// .WithMany(p => p.Seasons)
|
||||||
.HasForeignKey(pt => pt.GameId);
|
// .HasForeignKey(pt => pt.GameId);
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region EventGame
|
//#region EventGame
|
||||||
|
|
||||||
modelBuilder.Entity<EventGame>()
|
//modelBuilder.Entity<EventGame>()
|
||||||
.HasKey(t => new { t.EventId, t.GameId });
|
// .HasKey(t => new { t.EventId, t.GameId });
|
||||||
|
|
||||||
modelBuilder.Entity<EventGame>()
|
//modelBuilder.Entity<EventGame>()
|
||||||
.HasOne(pt => pt.Event)
|
// .HasOne(pt => pt.Event)
|
||||||
.WithMany(p => p.Games)
|
// .WithMany(p => p.Games)
|
||||||
.HasForeignKey(pt => pt.EventId);
|
// .HasForeignKey(pt => pt.EventId);
|
||||||
|
|
||||||
modelBuilder.Entity<EventGame>()
|
//modelBuilder.Entity<EventGame>()
|
||||||
.HasOne(pt => pt.Game)
|
// .HasOne(pt => pt.Game)
|
||||||
.WithMany(p => p.Events)
|
// .WithMany(p => p.Events)
|
||||||
.HasForeignKey(pt => pt.GameId);
|
// .HasForeignKey(pt => pt.GameId);
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region WordPress WPBooking
|
#region WordPress WPBooking
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace LaDOSE.Entity
|
|
||||||
{
|
|
||||||
public class Event : Context.Entity
|
|
||||||
{
|
|
||||||
//[Key]
|
|
||||||
//public int Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public int SeasonId { get; set; }
|
|
||||||
public Season Season { get; set; }
|
|
||||||
public bool Ranking { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public virtual IEnumerable<EventGame> Games { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
namespace LaDOSE.Entity
|
|
||||||
{
|
|
||||||
public class EventGame
|
|
||||||
{
|
|
||||||
|
|
||||||
public int EventId { get; set; }
|
|
||||||
public Event Event { get; set; }
|
|
||||||
public int GameId { get; set; }
|
|
||||||
public Game Game { get; set; }
|
|
||||||
|
|
||||||
public int? ChallongeId { get; set; }
|
|
||||||
public string ChallongeUrl { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,16 +13,8 @@ namespace LaDOSE.Entity
|
|||||||
public string WordPressTagOs { get; set; }
|
public string WordPressTagOs { get; set; }
|
||||||
|
|
||||||
public int? SmashId { get; set; }
|
public int? SmashId { get; set; }
|
||||||
public virtual IEnumerable<SeasonGame> Seasons { get; set; }
|
|
||||||
public virtual IEnumerable<EventGame> Events { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
public class SmashParticipent : Context.Entity
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Tag { get; set; }
|
|
||||||
public int? SmashId{ get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace LaDOSE.Entity
|
|
||||||
{
|
|
||||||
public class Season : Context.Entity
|
|
||||||
{
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public DateTime StartDate { get; set; }
|
|
||||||
public DateTime EndDate { get; set; }
|
|
||||||
|
|
||||||
public virtual IEnumerable<SeasonGame> Games { get; set; }
|
|
||||||
|
|
||||||
public virtual IEnumerable<Event> Event { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
namespace LaDOSE.Entity
|
|
||||||
{
|
|
||||||
public class SeasonGame
|
|
||||||
{
|
|
||||||
public int GameId { get; set; }
|
|
||||||
public Game Game { get; set; }
|
|
||||||
public int SeasonId { get; set; }
|
|
||||||
public Season Season { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
30
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Event.cs
Normal file
30
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Event.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace LaDOSE.Entity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represent a Event (Multiple tournaments)
|
||||||
|
/// </summary>
|
||||||
|
public class Event : Context.Entity
|
||||||
|
{
|
||||||
|
public Event()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event(string name,int? smashId)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
SmashId = smashId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Name { get; set; }
|
||||||
|
public int? SmashId { get; set; }
|
||||||
|
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
public List<Tournament> Tournaments { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
31
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Player.cs
Normal file
31
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Player.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
|
namespace LaDOSE.Entity
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public class Player : Context.Entity
|
||||||
|
{
|
||||||
|
public Player()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player(string name, int? challongeId, int? smashId)
|
||||||
|
{
|
||||||
|
this.Name = name;
|
||||||
|
ChallongeId = challongeId;
|
||||||
|
SmashId = smashId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String SmashName { get; set; }
|
||||||
|
public String Name { get; set; }
|
||||||
|
public int? ChallongeId {get;set;}
|
||||||
|
public int? SmashId {get;set;}
|
||||||
|
|
||||||
|
public Boolean IsChallonge => ChallongeId.HasValue;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
27
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Result.cs
Normal file
27
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Result.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
namespace LaDOSE.Entity
|
||||||
|
{
|
||||||
|
public class Result : Context.Entity
|
||||||
|
{
|
||||||
|
|
||||||
|
public Result(Player player, int point, int rank, Tournament tournament)
|
||||||
|
{
|
||||||
|
Player = player;
|
||||||
|
Point = point;
|
||||||
|
Rank = rank;
|
||||||
|
Tournament = tournament;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Result()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public int PlayerId { get; set; }
|
||||||
|
public Player Player { get; set; }
|
||||||
|
public int IdTournament { get; set; }
|
||||||
|
public Tournament Tournament{ get; set; }
|
||||||
|
public int Point { get; set; }
|
||||||
|
public int Rank { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
25
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Tournament.cs
Normal file
25
LaDOSE.Src/LaDOSE.Entity/TournamentEntities/Tournament.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace LaDOSE.Entity
|
||||||
|
{
|
||||||
|
public class Tournament : Context.Entity
|
||||||
|
{
|
||||||
|
public Tournament()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tournament(string name, int challongeId, int smashId)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
ChallongeId = challongeId;
|
||||||
|
SmashId = smashId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Name { get; set; }
|
||||||
|
public int ChallongeId {get;set;}
|
||||||
|
public int SmashId {get;set;}
|
||||||
|
public int? GameId {get;set;}
|
||||||
|
public Game Game { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace LaDOSE.Business.Interface
|
namespace LaDOSE.Business.Interface
|
||||||
{
|
{
|
||||||
public interface ISeasonService : IBaseService<Season>
|
//public interface ISeasonService : IBaseService<Season>
|
||||||
{
|
//{
|
||||||
|
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
@@ -12,5 +12,6 @@ namespace LaDOSE.Business.Interface
|
|||||||
|
|
||||||
Task<TournamentsResult> GetTournamentsResult(List<int> ids);
|
Task<TournamentsResult> GetTournamentsResult(List<int> ids);
|
||||||
Task<TournamentsResult> GetSmashResult(string tournamentSlug);
|
Task<TournamentsResult> GetSmashResult(string tournamentSlug);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,23 +20,24 @@ namespace LaDOSE.Business.Service
|
|||||||
this._challongeProvider = challongeProvider;
|
this._challongeProvider = challongeProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Event GetById(int id)
|
//public override Event GetById(int id)
|
||||||
{
|
//{
|
||||||
return _context.Event.Include(e => e.Season).Include(e => e.Games).ThenInclude(e => e.Game)
|
// re
|
||||||
.FirstOrDefault(e => e.Id == id);
|
// //return _context.Event.Include(e => e.Season).Include(e => e.Games).ThenInclude(e => e.Game)
|
||||||
}
|
// // .FirstOrDefault(e => e.Id == id);
|
||||||
|
//}
|
||||||
|
|
||||||
public override Event Create(Event e)
|
//public override Event Create(Event e)
|
||||||
{
|
//{
|
||||||
if (e.Id != 0)
|
// if (e.Id != 0)
|
||||||
{
|
// {
|
||||||
throw new Exception("Id is invalid");
|
// throw new Exception("Id is invalid");
|
||||||
}
|
// }
|
||||||
|
|
||||||
var eventAdded = _context.Event.Add(e);
|
// var eventAdded = _context.Event.Add(e);
|
||||||
_context.SaveChanges();
|
// _context.SaveChanges();
|
||||||
return eventAdded.Entity;
|
// return eventAdded.Entity;
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ namespace LaDOSE.Business.Service
|
|||||||
|
|
||||||
public override IEnumerable<Game> GetAll()
|
public override IEnumerable<Game> GetAll()
|
||||||
{
|
{
|
||||||
return _context.Game.Include(e => e.Seasons).ThenInclude(e=>e.Season).ToList();
|
return _context.Game.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetNextFreeOrder()
|
public int GetNextFreeOrder()
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
using LaDOSE.Business.Interface;
|
|
||||||
using LaDOSE.Entity;
|
|
||||||
using LaDOSE.Entity.Context;
|
|
||||||
|
|
||||||
namespace LaDOSE.Business.Service
|
|
||||||
{
|
|
||||||
public class SeasonService : BaseService<Season>, ISeasonService
|
|
||||||
{
|
|
||||||
public SeasonService(LaDOSEDbContext context) : base(context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,6 +11,7 @@ using LaDOSE.Entity.Context;
|
|||||||
using LaDOSE.Entity.Wordpress;
|
using LaDOSE.Entity.Wordpress;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
using Microsoft.EntityFrameworkCore.Internal;
|
||||||
|
using Result = LaDOSE.Entity.Challonge.Result;
|
||||||
|
|
||||||
namespace LaDOSE.Business.Service
|
namespace LaDOSE.Business.Service
|
||||||
{
|
{
|
||||||
@@ -120,18 +121,18 @@ namespace LaDOSE.Business.Service
|
|||||||
var Top8 = tournament.Participents.Where(p => p.Rank > 4 && p.Rank < 9).ToList();
|
var Top8 = tournament.Participents.Where(p => p.Rank > 4 && p.Rank < 9).ToList();
|
||||||
var Top16 = tournament.Participents.Where(p => p.Rank > 8 && p.Rank <= 16).ToList();
|
var Top16 = tournament.Participents.Where(p => p.Rank > 8 && p.Rank <= 16).ToList();
|
||||||
|
|
||||||
result.Results.Add(new Result(first.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.FirstPoint,first.Rank??0));
|
result.Results.Add(new Result(first.Name, tournament.Game?.Id??0, tournament.ChallongeId, tournament.Url, currentRule.FirstPoint,first.Rank??0));
|
||||||
lesSacs.Remove(first);
|
lesSacs.Remove(first);
|
||||||
result.Results.Add(new Result(second.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.SecondPoint, second.Rank ?? 0));
|
result.Results.Add(new Result(second.Name, tournament.Game?.Id ?? 0, tournament.ChallongeId, tournament.Url, currentRule.SecondPoint, second.Rank ?? 0));
|
||||||
lesSacs.Remove(second);
|
lesSacs.Remove(second);
|
||||||
thirdFourth.ForEach(r =>
|
thirdFourth.ForEach(r =>
|
||||||
result.Results.Add(new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url,
|
result.Results.Add(new Result(r.Name, tournament.Game?.Id ?? 0, tournament.ChallongeId, tournament.Url,
|
||||||
currentRule.ThirdFourthPoint, r.Rank ?? 0)));
|
currentRule.ThirdFourthPoint, r.Rank ?? 0)));
|
||||||
thirdFourth.ForEach(p => lesSacs.Remove(p));
|
thirdFourth.ForEach(p => lesSacs.Remove(p));
|
||||||
if (currentRule.Top8Point != 0)
|
if (currentRule.Top8Point != 0)
|
||||||
{
|
{
|
||||||
Top8.ForEach(r =>
|
Top8.ForEach(r =>
|
||||||
result.Results.Add(new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.Top8Point, r.Rank ?? 0)));
|
result.Results.Add(new Result(r.Name, tournament.Game?.Id ?? 0, tournament.ChallongeId, tournament.Url, currentRule.Top8Point, r.Rank ?? 0)));
|
||||||
Top8.ForEach(p => lesSacs.Remove(p));
|
Top8.ForEach(p => lesSacs.Remove(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,17 +140,21 @@ namespace LaDOSE.Business.Service
|
|||||||
{
|
{
|
||||||
Top16.ForEach(r =>
|
Top16.ForEach(r =>
|
||||||
result.Results.Add(
|
result.Results.Add(
|
||||||
new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.Top16Point, r.Rank ?? 0)));
|
new Result(r.Name, tournament.Game?.Id ?? 0, tournament.ChallongeId, tournament.Url, currentRule.Top16Point, r.Rank ?? 0)));
|
||||||
Top16.ForEach(p => lesSacs.Remove(p));
|
Top16.ForEach(p => lesSacs.Remove(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
lesSacs.ForEach(r =>
|
lesSacs.ForEach(r =>
|
||||||
result.Results.Add(new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url,
|
result.Results.Add(new Result(r.Name, tournament.Game?.Id ?? 0, tournament.ChallongeId, tournament.Url,
|
||||||
currentRule.Participation, r.Rank ?? 0)));
|
currentRule.Participation, r.Rank ?? 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Games = tournaments.Select(e => e.Game).Distinct((game, game1) => game.Name == game1.Name).ToList();
|
result.Games = tournaments.Select(e => e.Game).Distinct((game, game1) => game.Name == game1.Name).Where(e=>e!=null).ToList();
|
||||||
|
if (result.Games == null)
|
||||||
|
{
|
||||||
|
result.Games = new List<Game>();
|
||||||
|
}
|
||||||
|
result.Games.Add(new Game() {Id = 0, Order = 9999,Name = "UNKNOW"});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,6 +241,8 @@ namespace LaDOSE.Business.Service
|
|||||||
return await Task.FromResult(result);
|
return await Task.FromResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the tournament exist in database otherwise call Challonge.
|
/// Check if the tournament exist in database otherwise call Challonge.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -271,6 +278,10 @@ namespace LaDOSE.Business.Service
|
|||||||
return tournaments;
|
return tournaments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<object> GetSmashTop(string tournamentSlug, string eventId,int playerCount)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
private bool TournamentExist(int idTournament)
|
private bool TournamentExist(int idTournament)
|
||||||
{
|
{
|
||||||
return this._context.ChallongeTournament.Any(e => e.ChallongeId == idTournament);
|
return this._context.ChallongeTournament.Any(e => e.ChallongeId == idTournament);
|
||||||
|
|||||||
Reference in New Issue
Block a user