Mam tabele Match, Gamer i Users. Mam pytanie jak w entity zbudować zapytanie na podstawie obiektów żeby finalnie zwrócić listę obiektów JSON w postaci:
"match":
{
"Id" : 2,
"TurnamentId" : 4,
"StartDate" : "2019-11-24,
"Gamers" :
{
{
"Id" : 3,
"MatchId" : 2,
"Position" : 6,
"Name" : "Stefan",
"Email" : stefan@stefan.pl
} ,
{
"Id" : 5,
"MatchId" : 2,
"Position" : 3,
"Name" : "Edward",
"Email" : edward@edward.pl
}
}
}
Tabele:
Match:
public int Id { get; protected set; }
public int TurnamentId { get; protected set; }
public DateTime StartDate { get; protected set; }
public virtual ICollection<Gamer> Gamers {get; protected set;}
Gamer:
public int Id { get; protected set; }
public int MatchId { get; protected set; }
public int UserId { get; protected set; }
public int Position { get; protected set; }
Users:
public int Id { get; protected set; }
public string Name { get; protected set; }
public string Email { get; protected set; }