private MSD1 mapMSD1DataToMSD1(string Id) { Msd1Data msd1Data = _context.Msd1Data.First(x => x.Msd1Id == Id) ?? new Msd1Data(); MSD1 msd1 = new MSD1() { Imo = msd1Data.Imo, ShipName = msd1Data.ShipName ?? _helperService.GetShipNameByIMO(msd1Data.Imo), Deadweight = _helperService.GetDeadweightByIMO(msd1Data.Imo), Year = msd1Data.Year, Quarter = msd1Data.Quarter, AssociatedPort = _helperService.GetPortNameByCode(msd1Data.AssociatedPort) ?? msd1Data.AssociatedPort, ReportingPort = _helperService.GetPortNameByCode(msd1Data.ReportingPort) ?? msd1Data.ReportingPort, NumVoyages = msd1Data.NumVoyages, IsInbound = msd1Data.IsInbound, Msd1Id = msd1Data.Msd1Id, AgentSenderID = msd1Data.AgentSenderId, AgentCompanyName = _helperService.GetCompanyNameBySenderID(msd1Data.AgentSenderId) ?? string.Empty, LineSenderID = msd1Data.LineSenderId, LineCompanyName = _helperService.GetCompanyNameBySenderID(msd1Data.LineSenderId) ?? string.Empty, FlagCode = _helperService.GetFlagCodeFromIMO(msd1Data.Imo) ?? string.Empty, RecordRef = msd1Data.RecordRef, CargoSummary = MapMsd1CargoSummaryToCargoItem(msd1Data.Msd1Id) }; return(msd1); }