コード例 #1
0
 public CommentLikedEvent(IValueCommentAggregateChildDataModel model)
     : base(model,
            CommentAggConstants.EventType.CommentLiked,
            typeof(CommentLikedEvent).AssemblyQualifiedName)
 {
     this.ParentId = model.ParentId;
 }
コード例 #2
0
        public ValueCommentAggregateChild AddComment(IValueCommentAggregateChildDataModel model, bool applyEvent = true)
        {
            var comment = new ValueCommentAggregateChild(this, model.Id);

            comment.AddComment(model, applyEvent);
            return(comment);
        }
コード例 #3
0
 public CommentAddedEvent(IValueCommentAggregateChildDataModel model)
     : base(model,
            CommentAggConstants.EventType.CommentAdded,
            typeof(CommentAddedEvent).AssemblyQualifiedName)
 {
     this.ParentId    = model.ParentId;
     this.CommentText = model.CommentText;
     this.Likes       = model.Likes;
     this.Dislikes    = model.Dislikes;
     this.UserName    = model.UserName;
 }
コード例 #4
0
 public CommentViewModel ToViewModel(IValueCommentAggregateChildDataModel comment)
 {
     return(new CommentViewModel
     {
         Id = comment.Id,
         UserName = new DtoProp <string>(comment.UserName),
         ParentVersion = new DtoProp <long?>(comment.ParentVersion),
         ParentId = comment.ParentId,
         TenantId = new DtoProp <int?>(comment.TenantId),
         CommentText = new DtoProp <string>(comment.CommentText),
         Dislikes = new DtoProp <int?>(comment.Dislikes),
         Likes = new DtoProp <int?>(comment.Likes)
     });
 }
コード例 #5
0
        public void AddComment(IValueCommentAggregateChildDataModel model, bool applyEvent = true)
        {
            // when a comment is first added, we don't need to fire individual events
            ChangeCommentText(model.CommentText, applyEvent: false);
            ChangeCommentUser(model.UserName, applyEvent: false);
            ChangeTenantId(model.TenantId);

            if (!applyEvent)
            {
                return;
            }

            ApplyEvent(CommentEventTypes.CommentAdded);
        }