improve ReadShowDto.cs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using PF3.Models;
|
||||
|
||||
namespace PF3.DTO.Show.Response;
|
||||
|
||||
@@ -10,4 +11,14 @@ public class ReadShowDto
|
||||
public string? Description { get; set; }
|
||||
public string? PyrotechnicImplementationPlan { get; set; }
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
public int CityId { get; set; }
|
||||
public string? City { get; set; }
|
||||
|
||||
public List<ShowStaff>? ShowStaffs { get; set; }
|
||||
public List<ShowTruck>? ShowTrucks { get; set; }
|
||||
public List<Models.SoundTimecode>? SoundTimecodes { get; set; }
|
||||
public List<ProductTimecode>? ProductTimecodes { get; set; }
|
||||
public List<Contract>? Contracts { get; set; }
|
||||
public List<ShowMaterial>? ShowMaterials { get; set; }
|
||||
}
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user