public void AddVote(ulong userId, VoteType vote = VoteType.Upvote) { if (IsClosed) { throw new Exception("The report specified has already been closed."); } if (Votes.All(x => x.UserId != userId)) { Votes.Add(new VoteInfo(userId, vote)); return; } VoteInfo info = Votes.First(x => x.UserId == userId); if (info.Vote == vote) { return; } Votes[Votes.IndexOf(info)].Vote = vote; }
public void Finish() { var maxVotes = Votes.Max(x => x.Value); Winner = Votes.First(x => x.Value == maxVotes).Key; }