forked from sanchezvem/PyroFetes
20 lines
583 B
C#
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);
|
|
}
|
|
} |