Watch
1
0
Fork
You've already forked test-web
0
test-web/src/Core/Jobs/DeleteJobEndpoint.cs
Chris Dill 1199bef0c8
All checks were successful
Build / build (push) Successful in 43s
Initial commit
2026-06-06 10:47:36 +01:00

20 lines
446 B
C#

namespace TestWeb.Core.Jobs;
using Infra;
public static class DeleteJobEndpoint
{
public static async Task<Results<Ok, NotFound>> Handle(
int id,
AppDbContext db,
CancellationToken ct)
{
var rowsDeleted = await db.Jobs
.Where(x => x.Id == id)
.ExecuteDeleteAsync(ct);
return rowsDeleted == 1
? TypedResults.Ok()
: TypedResults.NotFound();
}
}