using Femto.Common.Domain; using Microsoft.EntityFrameworkCore; namespace Femto.Modules.Blog.Application.Commands.AddPostComment; internal class AddPostCommentCommandHandler(BlogContext context) : ICommandHandler { public async Task Handle(AddPostCommentCommand request, CancellationToken cancellationToken) { var post = await context.Posts.SingleOrDefaultAsync( p => p.Id == request.PostId, cancellationToken ); if (post is null) return; post.AddComment(request.AuthorId, request.Content); } }