32 lines
990 B
C#
32 lines
990 B
C#
namespace ScoreboardApi.Objects
|
|
{
|
|
using System.Text.Json.Serialization;
|
|
|
|
public class Game
|
|
{
|
|
public GameState State { get; set; }
|
|
public DateTimeOffset StartedAt { get; set; }
|
|
public DateTimeOffset? FinishedAt { get; set; }
|
|
public Team Home { get; set; } = new Team();
|
|
public Team Away { get; set; } = new Team();
|
|
public HalfType Half { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public List<Event> MatchEvents { get; set; } = new List<Event>();
|
|
|
|
public IEnumerable<Event> EventHistory
|
|
{
|
|
get
|
|
{
|
|
var events = Home.EventHistory
|
|
.Concat(Away.EventHistory)
|
|
.Concat(MatchEvents)
|
|
.OrderBy(x=>x.Id);
|
|
return events.ToList();
|
|
}
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public List<Team> Teams => new() { Home, Away };
|
|
}
|
|
} |