add missed dto/enbdpoints
This commit is contained in:
25
PyroFetes/Endpoints/Customer/GetAllCustomerEndpoint.cs
Normal file
25
PyroFetes/Endpoints/Customer/GetAllCustomerEndpoint.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Customer.Response;
|
||||
|
||||
namespace PyroFetes.Endpoints.Customer;
|
||||
|
||||
public class GetAllCustomerEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetCustomerDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get ("/api/Customer");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
List<GetCustomerDto> customer= await pyroFetesDbContext.Customers.Select(x => new GetCustomerDto()
|
||||
{
|
||||
Id = x.Id,
|
||||
Note = x.Note,
|
||||
}).ToListAsync(ct);
|
||||
|
||||
await Send.OkAsync(customer, ct);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user