forked from sanchezvem/PyroFetes
commentaire endpoint
This commit is contained in:
@@ -8,21 +8,21 @@ public class GetAllClassificationsEndpoint(PyroFetesDbContext pyrofetesdbcontext
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/classifications");
|
||||
AllowAnonymous();
|
||||
Get("/api/classifications"); //Endpoint qui affiche toutes les classifications
|
||||
AllowAnonymous(); //Autorise l'accès sans authentification
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
|
||||
List<GetClassificationDto> responseDto = await pyrofetesdbcontext.Classifications
|
||||
.Select(a => new GetClassificationDto
|
||||
List<GetClassificationDto> responseDto = await pyrofetesdbcontext.Classifications //Création d'une liste qui récupère toutes les classifications dans la bdd
|
||||
.Select(a => new GetClassificationDto //Sélectionne dans la liste chaque classification
|
||||
{
|
||||
Id = a.Id,
|
||||
Label = a.Label,
|
||||
Id = a.Id, //Récupère l'id
|
||||
Label = a.Label, //Récupère le label
|
||||
}
|
||||
).ToListAsync(ct);
|
||||
).ToListAsync(ct); //Retourne la liste de classification
|
||||
|
||||
await Send.OkAsync(responseDto, ct);
|
||||
await Send.OkAsync(responseDto, ct); //Envoie de la réponse réussite 200 au client
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user