using Microsoft.EntityFrameworkCore; using PyroFetes.DTO.ExperienceLevel.Response; namespace PyroFetes.Endpoints.ExperienceLevel; using FastEndpoints; public class GetAllExperienceLevelsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> { public override void Configure() { Get ("/api/experienceLevels"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { List experienceLevels= await pyroFetesDbContext.ExperienceLevels.Select(x => new GetExperienceLevelDto() { Id = x.Id, Label = x.Label, }).ToListAsync(ct); await Send.OkAsync(experienceLevels, ct); } }