public async Task <ANMCHCShipmentLogsResponse> RetrieveShipmentLogs(ANMCHCShipmentLogRequest asData) { var shipmentDetails = _anmchcShipmentData.RetrieveShipmentLog(asData); var shipmentLogResponse = new ANMCHCShipmentLogsResponse(); var shipmentLogs = new List <ShipmentLogs>(); try { var shipmentId = ""; foreach (var shipment in shipmentDetails.ShipmentLog) { if (shipmentId != shipment.shipmentId) { var shipmentLog = new ShipmentLogs(); var shipmentDetail = shipmentDetails.ShipmentSubjectDetail.Where(sd => sd.shipmentId == shipment.id).ToList(); shipmentLog.id = shipment.id; shipmentLog.shipmentId = shipment.shipmentId; shipmentLog.anmName = shipment.anmName; shipmentLog.testingCHC = shipment.testingCHC; shipmentLog.avdName = shipment.avdName; shipmentLog.contactNo = shipment.contactNo; shipmentLog.alternateAVD = shipment.alternateAVD; shipmentLog.alternateAVDContactNo = shipment.alternateAVDContactNo; shipmentLog.ilrPoint = shipment.ilrPoint; shipmentLog.riPoint = shipment.riPoint; shipmentLog.shipmentDateTime = shipment.shipmentDateTime; shipmentLog.SamplesDetail = shipmentDetail; shipmentId = shipment.shipmentId; shipmentLogs.Add(shipmentLog); } } shipmentLogResponse.ShipmentLogs = shipmentLogs; shipmentLogResponse.Status = "true"; shipmentLogResponse.Message = string.Empty; } catch (Exception e) { shipmentLogResponse.Status = "false"; shipmentLogResponse.Message = e.Message; } return(shipmentLogResponse); }
public async Task <ShipmentLogResponse> RetrieveShipmentLogs(int userId) { var shipmentLogDetails = _shipmentData.RetrieveShipmentLog(userId); var shipmentLogResponse = new ShipmentLogResponse(); var shipmentLogs = new List <ShipmentLogs>(); try { var generatedShipmentId = ""; foreach (var shipment in shipmentLogDetails.ShipmentLog) { if (generatedShipmentId != shipment.generatedShipmentId) { var shipmentLog = new ShipmentLogs(); var shipmentDetail = shipmentLogDetails.ShipmentSubjectDetail.Where(sd => sd.shipmentId == shipment.id).ToList(); shipmentLog.id = shipment.id; shipmentLog.generatedShipmentId = shipment.generatedShipmentId; shipmentLog.sentinelHospitalName = shipment.sentinelHospitalName; shipmentLog.receivingMolecularLab = shipment.receivingMolecularLab; shipmentLog.shipmentDateTime = shipment.shipmentDateTime; shipmentLog.senderName = shipment.senderName; shipmentLog.contactNo = shipment.contactNo; shipmentLog.samplesDetail = shipmentDetail; generatedShipmentId = shipment.generatedShipmentId; shipmentLogs.Add(shipmentLog); } } shipmentLogResponse.ShipmentLogs = shipmentLogs; shipmentLogResponse.Status = "true"; shipmentLogResponse.Message = string.Empty; } catch (Exception e) { shipmentLogResponse.Status = "false"; shipmentLogResponse.Message = e.Message; } return(shipmentLogResponse); }