public IEnumerable <IIdeaIdeaCommentPair> Create(IEnumerable <Entity> ideaEntities, IEnumerable <Entity> ideaCommentEntities)
        {
            var ideas    = new IdeaFactory(_serviceContext, _httpContext, _portalUser).Create(ideaEntities);
            var comments = new IdeaCommentFactory(_serviceContext).Create(ideaCommentEntities);

            return(comments.Select(comment =>
                                   new IdeaIdeaCommentPair(
                                       ideas.First(idea => idea.Id == (comment.Entity.GetAttributeValue <EntityReference>("adx_ideaid") == null ? Guid.Empty : comment.Entity.GetAttributeValue <EntityReference>("adx_ideaid").Id)),
                                       comment)));
        }
Exemple #2
0
        public IEnumerable <IIdeaIdeaVotePair> Create(IEnumerable <Entity> ideaEntities, IEnumerable <Entity> ideaVoteEntities)
        {
            var ideas = new IdeaFactory(_serviceContext, _httpContext, _portalUser).Create(ideaEntities);

            var votes = ideaVoteEntities.ToArray();

            return(votes.Select(vote =>
                                new IdeaIdeaVotePair(
                                    ideas.First(idea => idea.Entity.ToEntityReference() == vote.GetAttributeValue <EntityReference>("adx_ideaid")),
                                    new IdeaVote(vote))));
        }