diff --git a/project/ProjectTourAgency/Implementations/TourRepository.cs b/project/ProjectTourAgency/Implementations/TourRepository.cs index f0eaf9f..f78bf25 100644 --- a/project/ProjectTourAgency/Implementations/TourRepository.cs +++ b/project/ProjectTourAgency/Implementations/TourRepository.cs @@ -83,7 +83,7 @@ WHERE Id = @id"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var querySelect = @" -SELECT t.*, ct.TourId, ct.Cost FROM Tour t +SELECT t.*, ct.TourId, ct.Cost, ct.ClientId FROM Tour t INNER JOIN ClientTour ct ON ct.TourId = t.Id"; var tour = connection.Query(querySelect); _logger.LogDebug("Получение объектов {json}", JsonConvert.SerializeObject(tour)); diff --git a/project/ProjectTourAgency/Reports/TableReportcs.cs b/project/ProjectTourAgency/Reports/TableReportcs.cs index 8bff658..44589a0 100644 --- a/project/ProjectTourAgency/Reports/TableReportcs.cs +++ b/project/ProjectTourAgency/Reports/TableReportcs.cs @@ -52,7 +52,7 @@ internal class TableReport endDate) { var data = _tourRepository.ReadTours().Select(x => new { - ClientId = (int ?)x.ClientTours.Sum(x => x.ClientId), + ClientId = (int ?)x.ClientTours.FirstOrDefault(y => y.TourId > 0).ClientId, Date = x.DepartureDate, CountIn = (int?)null, CountOut = (int?)x.ClientTours.Sum(x => x.Cost)