Commit Debut de rework
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using LaDOSE.Entity.Challonge;
|
||||
|
||||
using LaDOSE.Entity.Wordpress;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -8,19 +9,25 @@ namespace LaDOSE.Entity.Context
|
||||
{
|
||||
public DbSet<Game> Game { 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; }
|
||||
|
||||
#region WordPress
|
||||
public DbSet<WPUser> WPUser { get; set; }
|
||||
public DbSet<WPEvent> WPEvent { get; set; }
|
||||
public DbSet<WPBooking> WPBooking { get; set; }
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#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<SeasonGame> SeasonGame { get; set; }
|
||||
public DbSet<EventGame> EventGame { get; set; }
|
||||
public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
|
||||
public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
|
||||
|
||||
@@ -36,43 +43,43 @@ namespace LaDOSE.Entity.Context
|
||||
|
||||
|
||||
|
||||
modelBuilder.Entity<Event>()
|
||||
.HasOne(s => s.Season)
|
||||
.WithMany(p => p.Event)
|
||||
.HasForeignKey(fk => fk.SeasonId);
|
||||
//modelBuilder.Entity<Event>()
|
||||
// .HasOne(s => s.Season)
|
||||
// .WithMany(p => p.Event)
|
||||
// .HasForeignKey(fk => fk.SeasonId);
|
||||
|
||||
|
||||
|
||||
#region SeasonGame
|
||||
modelBuilder.Entity<SeasonGame>()
|
||||
.HasKey(t => new { t.SeasonId, t.GameId });
|
||||
//#region SeasonGame
|
||||
//modelBuilder.Entity<SeasonGame>()
|
||||
// .HasKey(t => new { t.SeasonId, t.GameId });
|
||||
|
||||
modelBuilder.Entity<SeasonGame>()
|
||||
.HasOne(pt => pt.Season)
|
||||
.WithMany(p => p.Games)
|
||||
.HasForeignKey(pt => pt.SeasonId);
|
||||
//modelBuilder.Entity<SeasonGame>()
|
||||
// .HasOne(pt => pt.Season)
|
||||
// .WithMany(p => p.Games)
|
||||
// .HasForeignKey(pt => pt.SeasonId);
|
||||
|
||||
modelBuilder.Entity<SeasonGame>()
|
||||
.HasOne(pt => pt.Game)
|
||||
.WithMany(p => p.Seasons)
|
||||
.HasForeignKey(pt => pt.GameId);
|
||||
#endregion
|
||||
//modelBuilder.Entity<SeasonGame>()
|
||||
// .HasOne(pt => pt.Game)
|
||||
// .WithMany(p => p.Seasons)
|
||||
// .HasForeignKey(pt => pt.GameId);
|
||||
//#endregion
|
||||
|
||||
#region EventGame
|
||||
//#region EventGame
|
||||
|
||||
modelBuilder.Entity<EventGame>()
|
||||
.HasKey(t => new { t.EventId, t.GameId });
|
||||
//modelBuilder.Entity<EventGame>()
|
||||
// .HasKey(t => new { t.EventId, t.GameId });
|
||||
|
||||
modelBuilder.Entity<EventGame>()
|
||||
.HasOne(pt => pt.Event)
|
||||
.WithMany(p => p.Games)
|
||||
.HasForeignKey(pt => pt.EventId);
|
||||
//modelBuilder.Entity<EventGame>()
|
||||
// .HasOne(pt => pt.Event)
|
||||
// .WithMany(p => p.Games)
|
||||
// .HasForeignKey(pt => pt.EventId);
|
||||
|
||||
modelBuilder.Entity<EventGame>()
|
||||
.HasOne(pt => pt.Game)
|
||||
.WithMany(p => p.Events)
|
||||
.HasForeignKey(pt => pt.GameId);
|
||||
#endregion
|
||||
//modelBuilder.Entity<EventGame>()
|
||||
// .HasOne(pt => pt.Game)
|
||||
// .WithMany(p => p.Events)
|
||||
// .HasForeignKey(pt => pt.GameId);
|
||||
//#endregion
|
||||
|
||||
#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 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; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user