public void Apply(VotingCreatedEvent @event) { Id = @event.VotingId; _topics = @event.Topics; _votingPair = VotingPair.Empty(); _winner = string.Empty; }
public VotingSnapshot(Guid votingId, VotingPair votingPair, string winner) { VotingId = votingId; Winner = winner; votingPair = votingPair ?? VotingPair.Empty(); Topics = new Dictionary <string, int> (); if (!votingPair.IsEmpty) { Topics.Add(votingPair.TopicA.topic, votingPair.TopicA.votes); Topics.Add(votingPair.TopicB.topic, votingPair.TopicB.votes); } }