Here is my query :
public ActionResult ClosedOrdersDetails(string id, string OrdreNo)
{
OrdreDetails_VM odvm = new OrdreDetails_VM();
var col2 = (from sih in data.Sales_Invoice_Header
join ve in data.Value_Entry on sih.No_ equals ve.Document_No_
join ile in data.Item_Ledger_Entry on ve.Item_Ledger_Entry_No_ equals ile.Entry_No_
join shipment in data.Sales_Shipment_Line on ile.Document_No_ equals shipment.Document_No_
join trackandtrace in data.Track_and_Trace on shipment.Document_No_ equals trackandtrace.Shipping_No_
where shipment.Order_No_ == OrdreNo && ve.Adjustment == 0 && ve.Source_Code == "SALG" && shipment.Type != 0 && shipment.Quantity > 0
select new OrdreDetails_VM.ShipmentDetailLineClose
{
SerialNoInvoiceOrdrelineDeliveryClose = ile.Serial_No_.Select(x => x.ToString()).ToList(),
Qu = shipment.Quantity
}).ToList();
odvm.ShipmentDetailLineCloses = col2;
return View(odvm);
}And here is my View Model:
public class OrdreDetails_VM {
public List<ShipmentDetailLineClose> ShipmentDetailLineCloses { get; set; }
public class ShipmentDetailLineClose {
public ShipmentDetailLineClose(List<string> SerialNoInvoiceOrdrelineDeliveryClose, decimal Qu)
{
this.SerialNoInvoiceOrdrelineDeliveryClose = SerialNoInvoiceOrdrelineDeliveryClose;
this.Qu = Qu;
}
public List <string> SerialNoInvoiceOrdrelineDeliveryClose { get; set; }
public decimal Qu { get; set; }
}
}