public Challenge( ChallengeId id, ChallengeName name, Game game, BestOf bestOf, Entries entries, ChallengeTimeline timeline, IScoring scoring ) { this.SetEntityId(id); Name = name; Game = game; BestOf = bestOf; Entries = entries; Timeline = timeline; Scoring = scoring; this.AddDomainEvent(new ChallengeCreatedDomainEvent(this)); }
public static ChallengeState From(ChallengeTimeline timeline) { return(timeline.ClosedAt != null ? Closed : timeline.EndedAt != null && timeline.EndedAt <= DateTime.UtcNow ? Ended : timeline.StartedAt != null ? InProgress : Inscription); }