internal PollVote(InternalApi.PollVote pollVote) { PollId = pollVote.PollId; Answer = new PollAnswer(InternalApi.PollingService.GetPollAnswer(pollVote.PollAnswerId), InternalApi.PollingService.GetPoll(pollVote.PollId)); CreatedDate = InternalApi.Formatting.FromUtcToUserTime(pollVote.CreatedDateUtc); LastUpdatedDate = InternalApi.Formatting.FromUtcToUserTime(pollVote.LastUpdatedDateUtc); User = new User(pollVote.UserId); }
internal Poll(InternalApi.Poll poll) { Id = poll.Id; ContentId = poll.Id; Name = poll.Name; Description = InternalApi.PollingService.RenderPollDescription(poll, "webservices"); IsEnabled = poll.IsEnabled; CreatedDate = InternalApi.Formatting.FromUtcToUserTime(poll.CreatedDateUtc); LastUpdatedDate = InternalApi.Formatting.FromUtcToUserTime(poll.LastUpdatedDateUtc); Url = TEApi.Url.Absolute(InternalApi.PollingUrlService.PollUrl(poll.Id)); Answers = new List<PollAnswer>(poll.Answers.Select(x => new PollAnswer(x, poll))); Group = new Group(poll.ApplicationId); AuthorUser = new User(poll.AuthorUserId); HideResultsUntilVotingComplete = poll.HideResultsUntilVotingComplete; VotingEndDate = !poll.VotingEndDateUtc.HasValue ? null : (DateTime?) InternalApi.Formatting.FromUtcToUserTime(poll.VotingEndDateUtc.Value); TotalVotes = poll.Answers.Sum(x => x.VoteCount); }