Files
PyroFetes-Sujet1/PyroFetes/Endpoints/Suppliers/GetAllSuppliersEndpoint.cs
2025-11-20 15:11:14 +01:00

20 lines
583 B
C#

using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Supplier.Response;
using PyroFetes.Repositories;
namespace PyroFetes.Endpoints.Suppliers;
public class GetAllSuppliersEndpoint(SuppliersRepository suppliersRepository) : EndpointWithoutRequest<List<GetSupplierDto>>
{
public override void Configure()
{
Get("/api/suppliers");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await suppliersRepository.ProjectToListAsync<GetSupplierDto>(ct), ct);
}
}