commentaire endpoint

This commit is contained in:
2025-11-05 22:38:55 +01:00
parent 4c0e7df9de
commit 3c32baac57
45 changed files with 475 additions and 479 deletions

View File

@@ -8,27 +8,27 @@ public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext)
{
public override void Configure()
{
Put("/api/classifications");
AllowAnonymous();
Put("/api/classifications"); //Met à jour la classification en fonction de l'id
AllowAnonymous(); //Autorise l'accès sans authentification
}
public override async Task HandleAsync(UpdateClassificationDto req, CancellationToken ct)
{
Models.Classification classification = new()
Models.Classification classification = new() //Met à jour la classification
{
Label = req.Label
};
pyrofetesdbcontext.Add(classification);
await pyrofetesdbcontext.SaveChangesAsync(ct);
pyrofetesdbcontext.Add(classification); //ajoute la classification dans la bdd
await pyrofetesdbcontext.SaveChangesAsync(ct); //Sauvegarde les changements
GetClassificationDto response = new()
GetClassificationDto response = new() //renvoie l'id et le nom
{
Id = req.Id,
Label = req.Label
};
await Send.OkAsync(response, ct);
await Send.OkAsync(response, ct); //Envoie de la réponse réussite 200 au client
}
}