Пример #1
0
 /// <summary>
 /// 获取被评论对象(部分)
 /// </summary>
 /// <param name="commentedObjectId"></param>
 /// <returns></returns>
 public CommentedObject GetCommentedObject(long commentedObjectId)
 {
     ContentItem contentItem = new ContentItemService().Get(commentedObjectId);
     if (contentItem != null)
     {
         CommentedObject commentedObject = new CommentedObject();
         commentedObject.DetailUrl = SiteUrls.Instance().ContentItemDetail(commentedObjectId);
         commentedObject.Name = contentItem.Title;
         commentedObject.Author = contentItem.Author;
         commentedObject.UserId = contentItem.UserId;
         return commentedObject;
     }
     return null;
 }
 /// <summary>
 /// 获取被评论对象(部分)
 /// </summary>
 /// <param name="commentedObjectId"></param>
 /// <returns></returns>
 public CommentedObject GetCommentedObject(long commentedObjectId)
 {
     BlogThread blogThread = new BlogService().Get(commentedObjectId);
     if (blogThread != null)
     {
         CommentedObject commentedObject = new CommentedObject();
         commentedObject.DetailUrl = SiteUrls.Instance().BlogDetail(blogThread.User.UserName, commentedObjectId);
         commentedObject.Name = blogThread.Subject;
         commentedObject.Author = blogThread.Author;
         commentedObject.UserId = blogThread.UserId;
         return commentedObject;
     }
     return null;
 }
 /// <summary>
 /// 获取被评论对象(部分)
 /// </summary>
 /// <param name="commentedObjectId"></param>
 /// <returns></returns>
 public CommentedObject GetCommentedObject(long commentedObjectId)
 {
     MicroblogEntity microblog = new MicroblogService().Get(commentedObjectId);
     if (microblog != null)
     {
         CommentedObject commentedObject = new CommentedObject();
         commentedObject.DetailUrl = SiteUrls.Instance().ShowMicroblog(microblog.User.UserName, commentedObjectId);
         commentedObject.Name = microblog.Body;
         commentedObject.Author = microblog.User.DisplayName;
         commentedObject.UserId = microblog.UserId;
         return commentedObject;
     }
     return null;
 }