public void Unread(string userId, string sessionId) { var evt = new ArticleUnreadEvent(Guid.NewGuid().ToString(), Id, Version + 1, Language, userId, sessionId, DateTime.UtcNow); Handle(evt); DomainEvts.Add(evt); }
private void Handle(ArticleUnreadEvent evt) { var articleRead = ArticleReadLst.FirstOrDefault(a => a.UserId == evt.UserId); if (articleRead == null) { throw new DomainException(Global.ArticleNotReadByTheUser); } NbRead--; Version = evt.Version; UpdateDateTime = evt.ActionDateTime; ArticleReadLst.Remove(articleRead); }