Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shipments ShipmentNomenclatures Nomenclatures Products
- id id id id
- shipment_id model_id nomenclature_id
- nomenclature_id vendorCode showroom_id
- ShimpentViewModel
- Все поля из Shipment
- Models
- VendorCodes
- var shipmentViewModels = _dbContext.Value.ShipmentViewModels.FromSql (" SELECT [p].[Id],
- SUBSTRING((SELECT COALESCE(', ' + [sn.Nomenclature.Model].[Name], '') [text()]
- FROM ShipmentNomenclatures AS sn
- INNER JOIN [Nomenclatures] AS [sn.Nomenclature] ON [sn].[NomenclatureId] = [sn.Nomenclature].[Id]
- INNER JOIN [Models] AS[sn.Nomenclature.Model] ON [sn.Nomenclature].[ModelId] = [sn.Nomenclature.Model].[Id]
- WHERE [sn].[ShipmentId] = p.Id
- ORDER BY 1
- FOR XML PATH ('')
- ), 2, 1000) AS [Models]
- ,SUBSTRING((SELECT COALESCE (', ' + [sn.Nomenclature].[VendorCode], '') [text()]
- FROM ShipmentNomenclatures AS sn
- INNER JOIN [Nomenclatures] AS[sn.Nomenclature] ON [sn].[NomenclatureId] = [sn.Nomenclature].[Id]
- WHERE [sn].[ShipmentId] = p.Id
- ORDER BY 1
- FOR XML PATH ('')
- ), 2, 1000) AS [VendorCodes]
- FROM [Shipments] AS [p] ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement