using API.DTO.Brand.Response; using FastEndpoints; using PyroFetes.DTO.Brand.Request; namespace PyroFetes.Endpoints.Brand; public class UpdateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { Put("/api/brands"); AllowAnonymous(); } public override async Task HandleAsync(UpdateBrandDto req, CancellationToken ct) { Models.Brand brand = new() { Name = req.Name }; pyrofetesdbcontext.Add(brand); await pyrofetesdbcontext.SaveChangesAsync(ct); GetBrandDto response = new() { Id = req.Id, Name = req.Name }; await Send.OkAsync(response, ct); } }