Generic Service
JSON Reference loop Events
This commit is contained in:
@@ -7,6 +7,7 @@ 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<SeasonGame> SeasonGame { get; set; }
|
||||
|
||||
public LaDOSEDbContext(DbContextOptions options) : base(options)
|
||||
@@ -21,7 +22,10 @@ namespace LaDOSE.Entity.Context
|
||||
modelBuilder.Entity<SeasonGame>()
|
||||
.HasKey(t => new { t.SeasonId, t.GameId });
|
||||
|
||||
|
||||
modelBuilder.Entity<Event>()
|
||||
.HasOne(s => s.Season)
|
||||
.WithMany(p => p.Event)
|
||||
.HasForeignKey(fk => fk.SeasonId);
|
||||
|
||||
modelBuilder.Entity<SeasonGame>()
|
||||
.HasOne(pt => pt.Season)
|
||||
|
||||
17
LaDOSE.Src/LaDOSE.Entity/Event.cs
Normal file
17
LaDOSE.Src/LaDOSE.Entity/Event.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LaDOSE.Entity
|
||||
{
|
||||
public class Event
|
||||
{
|
||||
[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; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,7 @@ namespace LaDOSE.Entity
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
public virtual IEnumerable<SeasonGame> Games { get; set; }
|
||||
|
||||
public virtual IEnumerable<Event> Event { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user