improve ReadShowDto.cs

This commit is contained in:
2025-10-09 17:54:25 +02:00
parent 9d5b3474c2
commit 149f4f325c
2 changed files with 27 additions and 1 deletions

View File

@@ -16,6 +16,13 @@ public class GetShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<Rea
public override async Task HandleAsync(ReadShowDto req, CancellationToken ct)
{
var show = await pyroFetesDbContext.Shows
.Include(s => s.City)
.Include(s => s.ShowStaffs)
.Include(s => s.ShowTrucks)
.Include(s => s.SoundTimecodes)
.Include(s => s.ProductTimecodes)
.Include(s => s.Contracts)
.Include(s => s.ShowMaterials)
.Where(a => a.Id == req.Id)
.Select(a => new ReadShowDto
{
@@ -23,7 +30,15 @@ public class GetShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<Rea
Name = req.Name,
Place = req.Place,
Description = req.Description,
PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan
PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan,
CityId = a.CityId,
City = a.City!.Name,
ShowStaffs = a.ShowStaffs,
ShowTrucks = a.ShowTrucks,
SoundTimecodes = a.SoundTimecodes,
ProductTimecodes = a.ProductTimecodes,
Contracts = a.Contracts,
ShowMaterials = a.ShowMaterials,
})
.FirstOrDefaultAsync(ct);
await Send.OkAsync(show, ct);