using FastEndpoints; using Microsoft.EntityFrameworkCore; using PyroFetes.DTO.Provider.Response; namespace PyroFetes.Endpoints.Provider; public class GetAllProvidersEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> { public override void Configure() { Get ("/serviceproviders"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { List provider= await pyroFetesDbContext.ServiceProviders.Select(x => new GetProviderDto() { Id = x.Id, Price = x.Price, ProviderTypeId = x.ProviderTypeId, }).ToListAsync(ct); await Send.OkAsync(provider, ct); } }