First Commit 09/10
# Conflicts: # PyroFetes/PyroFetes.csproj
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.HistoryOfApproval.Response;
|
||||
|
||||
namespace PyroFetes.Endpoints.HistoryOfApproval;
|
||||
|
||||
public class GetAllHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetHistoryOfApprovalDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get ("/api/HistoryOfApprovals");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
List<GetHistoryOfApprovalDto> historyOfApprovals= await pyroFetesDbContext.HistoryOfApprovals.Select(x => new GetHistoryOfApprovalDto()
|
||||
{
|
||||
Id = x.Id,
|
||||
DeliveryDate = x.DeliveryDate,
|
||||
ExpirationDate = x.ExpirationDate,
|
||||
}).ToListAsync(ct);
|
||||
|
||||
await Send.OkAsync(historyOfApprovals, ct);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user