Example #1
0
        public static ElectionSummaryEntity ToElectionSummaryEntity(this ElectionSummary summary)
        {
            if (summary is null)
            {
                return(null);
            }

            var json        = JsonConvert.SerializeObject(summary.BallotEntries);
            var orderedJson = JsonConvert.SerializeObject(summary.ToOrderedSummary().BallotEntries);

            return(new ElectionSummaryEntity
            {
                IsComplete = true,
                PartitionKey = AzTableStorageElectionResultsRepository.ElectionSummaryPartitionKey,
                RowKey = AzTableStorageElectionResultsRepository.ElectionSummaryRowKey,
                BallotEntries = json,
                OrderedBallotEntries = orderedJson
            });
        }