using API.DTO.Classification.Request; using API.DTO.Classification.Response; using FastEndpoints; namespace PyroFetes.Endpoints.Classification; public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { Post("/api/classifications"); AllowAnonymous(); } public override async Task HandleAsync(UpdateClassificationDto req, CancellationToken ct) { Models.Classification classification = new() { Label = req.Label }; pyrofetesdbcontext.Add(classification); await pyrofetesdbcontext.SaveChangesAsync(ct); GetClassificationDto response = new() { Id = req.Id, Label = req.Label }; await Send.OkAsync(response, ct); } }