public async Task <Comment> Handle(GetCommentByIdQuery request, CancellationToken cancellationToken) { string functionName = "GetCommentById:Get:" + request.Id; Log.ForContext("Message", functionName) .ForContext("Error", "").Information(functionName); return(await _read.GetCommentById(request.Id)); }
public async Task <ResultStatus> Handle(RemoveCommentCommand request, CancellationToken cancellationToken) { string functionName = "RemoveComment:Get:" + request.Id; Log.ForContext("Message", functionName) .ForContext("Error", "") .Information(functionName); var comment = await _read.GetCommentById(request.Id); if (comment == null) { Log.ForContext("Message", functionName) .ForContext("Error", "CommentNotFound") .Error($"Error: ** {functionName}"); return(ResultStatus.NotFound); } await _write.RemoveComment(comment); await _write.Save(); return(ResultStatus.Success); }