Exemple #1
0
        public void Like(string userId, string sessionId)
        {
            var evt = new ArticleLikedEvent(Guid.NewGuid().ToString(), Id, Version + 1, Language, userId, sessionId, DateTime.UtcNow);

            Handle(evt);
            DomainEvts.Add(evt);
        }
Exemple #2
0
        private void Handle(ArticleLikedEvent evt)
        {
            if (ArticleLikeLst.Any(l => l.UserId == evt.UserId))
            {
                throw new DomainException(Global.ArticleAlreadyLikedByTheUser);
            }

            NbLikes++;
            Version        = evt.Version;
            UpdateDateTime = evt.ActionDateTime;
            ArticleLikeLst.Add(ArticleLike.Create(evt.UserId, evt.ActionDateTime));
        }