CreateShowEndpoint.cs et GetShowEndpoint.cs fini
This commit is contained in:
@@ -10,7 +10,7 @@ public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/show");
|
Post("/api/shows");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
31
PF3/Endpoint/Show/GetShowEndpoint.cs
Normal file
31
PF3/Endpoint/Show/GetShowEndpoint.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PF3.DTO.Show.Response;
|
||||||
|
using PF3.Migrations;
|
||||||
|
|
||||||
|
namespace PF3.Endpoint.Show;
|
||||||
|
|
||||||
|
public class GetShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<ReadShowDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/api/shows/{Id}", a=> a.Id!);
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(ReadShowDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
var show = await pyroFetesDbContext.Shows
|
||||||
|
.Where(a => a.Id == req.Id)
|
||||||
|
.Select(a => new ReadShowDto
|
||||||
|
{
|
||||||
|
Id = req.Id,
|
||||||
|
Name = req.Name,
|
||||||
|
Place = req.Place,
|
||||||
|
Description = req.Description,
|
||||||
|
PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan
|
||||||
|
})
|
||||||
|
.FirstOrDefaultAsync(ct);
|
||||||
|
await Send.OkAsync(show, ct);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user