private Vote VoteContent2VoteContent(VotePostModle post, Article article) { var vote= new Vote() { ArticleID=article.ArticleID, }; post.VoteItems.ForEach(item=> { vote.VoteItems.Add(new VoteItem() { }); }); return vote; }
private PostModelBase GetPostModelFromArticle(Article article, TextContent textContent, Vote vote, List<VotesItemModel> voteItems) { switch ((PostContentType)article.ContentType) { case PostContentType.TextContents: return new ContentPostModel() { AddDateTime = article.AddTime, SubjectID = article.SubjectID, SubjectName = article.Subject.Name, TopicName = article.Tittle, PostContentType = PostContentType.TextContents, TopicContent = textContent.Content }; case PostContentType.Votes: var item= new VotePostModle() { AddDateTime = article.AddTime, SubjectID = article.SubjectID, SubjectName = article.Subject.Name, TopicName = article.Tittle, PostContentType = PostContentType.TextContents, IsMutipleVote = vote.IsMultiple > 1, }; var list = from it in voteItems select new VotesItemModel() { }; item.VoteItems = list.ToList(); return item; default: return null; } }