コード例 #1
0
 internal Comment(CommentCreate creationData, User user)
 {
     PostId       = creationData.PostId;
     Body         = creationData.Body;
     ParentId     = creationData.ParentId;
     CreationDate = DateTime.UtcNow;
     UserId       = user.Id;
     Votes        = new VoteStats();
 }
コード例 #2
0
ファイル: CommentFactory.cs プロジェクト: maoyuan121/Updog.in
 public Comment Create(
     int id,
     int userId,
     int postId,
     int parentId,
     string body,
     VoteStats votes,
     DateTime creationDate,
     bool wasUpdated,
     bool wasDeleted
     ) => new Comment(id, userId, postId, parentId, body, votes, creationDate, wasUpdated, wasDeleted);
コード例 #3
0
 internal Comment(int id, int userId, int postId, int parentId, string body, VoteStats votes, DateTime creationDate, bool wasUpdated, bool wasDeleted)
 {
     Id           = id;
     UserId       = userId;
     PostId       = postId;
     ParentId     = parentId;
     Body         = body;
     Votes        = votes;
     CreationDate = creationDate;
     WasUpdated   = wasUpdated;
     WasDeleted   = wasDeleted;
 }
コード例 #4
0
ファイル: Post.cs プロジェクト: maoyuan121/Updog.in
        internal Post(int id, int userId, int spaceId, PostType type, string title, string body, DateTime creationDate, int commentCount, VoteStats votes, bool wasUpdated = false, bool wasDeleted = false)
        {
            Id           = id;
            UserId       = userId;
            SpaceId      = spaceId;
            Type         = type;
            Title        = title;
            Body         = body;
            CreationDate = creationDate;
            CommentCount = commentCount;
            Votes        = votes;
            WasUpdated   = wasUpdated;
            WasDeleted   = wasDeleted;

            if (Type == PostType.Link && !Regex.IsMatch(Body, RegexPattern.UrlProtocol))
            {
                Body = $"http://{Body}";
            }
        }