using PF3.DTO.Truck.Request; using FastEndpoints; using Microsoft.EntityFrameworkCore; using PF3; namespace ApiLibrary.Endpoints.Truck; public class DeleteTruckEndpoint(PF3DbContext pf3DbContext) : Endpoint { public override void Configure() { Delete("/api/trucks/{@Id}", x => new { x.Id }); } public override async Task HandleAsync(IdTruckDto req, CancellationToken ct) { var truck = await pf3DbContext.Trucks.FirstOrDefaultAsync(a => a.Id == req.Id, ct); pf3DbContext.Trucks.Remove(truck); await pf3DbContext.SaveChangesAsync(ct); await Send.OkAsync(ct); } }