public void Update(CommentUpdate update) { if (WasDeleted) { throw new InvalidOperationException(); } WasUpdated = true; Body = update.Body; }
public async Task Update(int commentId, CommentUpdate update, User user) { Comment?c = await repo.FindById(commentId); if (c == null) { throw new NotFoundException($"No comment with Id: {commentId} found."); } c.Update(update); await repo.Update(c); await bus.Dispatch(new CommentUpdateEvent(c)); }