Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
 public static ChallengeState From(ChallengeTimeline timeline)
 {
     return(timeline.ClosedAt != null ? Closed :
            timeline.EndedAt != null && timeline.EndedAt <= DateTime.UtcNow ? Ended :
            timeline.StartedAt != null ? InProgress : Inscription);
 }