1
This commit is contained in:
23
Yes.Blog/Endpoints/Admins/Comments/DeleteCommentEndpoint.cs
Normal file
23
Yes.Blog/Endpoints/Admins/Comments/DeleteCommentEndpoint.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
namespace Yes.Blog.Endpoints.Admins.Comments
|
||||
{
|
||||
public class DeleteCommentEndpoint : AdminEndpointScheme, IEndpoint
|
||||
{
|
||||
public void Map(IEndpointRouteBuilder app) => app.MapDelete("/comments", Handle);
|
||||
|
||||
public record Request(int Id);
|
||||
|
||||
|
||||
private async Task<IResult> Handle([AsParameters] Request request, IMediator mediator, IMapper mapper, CancellationToken cancellationToken)
|
||||
{
|
||||
var command = new DeleteCommentCommand(request.Id);
|
||||
var response = await mediator.Send(command, cancellationToken);
|
||||
|
||||
|
||||
return Result.Ok(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user