20 lines
446 B
C#
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();
|
|
}
|
|
}
|