示例#1
0
 public ArticleOpResult AddTextArticle(Article article, Vote vote)
 {
     vote.ArticleID = article.ArticleID = Guid.NewGuid().ToString();
     vote.VoteID = article.ContentID = Guid.NewGuid().ToString();
     article.ContentType = (int)PostContentType.TextContents;
     article.Votes.Clear();
     article.Votes.Add(vote);
     article.AddTime = DateTime.Now;
     article.UpdateTime = DateTime.Now;
     this.Articles.Add(article);
     return new ArticleOpResult() { HasError = false, ArticleID = article.ArticleID };
 }
示例#2
0
 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;
     }
 }
示例#3
0
 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;
 }
示例#4
0
 public DBOprationResult AddVote(Vote vote)
 {
     return new DBOprationResult() { HasError=false  };
 }