This commit is contained in:
commit
1199bef0c8
1 changed files with 1200 additions and 0 deletions
20
src/Core/Jobs/DeleteJobEndpoint.cs
Normal file
20
src/Core/Jobs/DeleteJobEndpoint.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue