public MAWBCustomizedFiled GetMawbCustomizePdf(int TradelaneShipmentId) { MAWBCustomizedFiled field = new MAWBCustomizedFiled(); var detail = dbContext.MAWBCustomizeds.Where(x => x.TradelaneShipmentId == TradelaneShipmentId).FirstOrDefault(); if (detail != null) { field.MAWBCustomizedeFieldId = detail.MAWBCustomizedeFieldID; field.TradelaneShipmentId = detail.TradelaneShipmentId ?? 0; field.IssuingCarriersAgentNameandCity = detail.IssuingCarriersAgentNameandCity; field.DeclaredValueForCarriage = detail.DeclaredValueForCarriage; field.DeclaredValueForCustoms = detail.DeclaredValueForCustoms; field.ValuationCharge = detail.ValuationCharge; field.Tax = detail.Tax; field.TotalOtherChargesDueAgent = detail.TotalOtherChargesDueAgent; field.TotalOtherChargesDueCarrier = detail.TotalOtherChargesDueCarrier; field.OtherCharges = detail.OtherCharges; field.ChargesAtDestination = detail.ChargesAtDestination; field.TotalCollectCharges = detail.TotalCollectCharges; field.CurrencyConversionRates = detail.CurrencyConversionRates; field.TotalPrepaid = detail.TotalPrepaid; field.TotalCollect = detail.TotalCollect; field.HandlingInformation = detail.HandlingInformation; field.AgentsIATACode = detail.AgentsIATACode; field.AccountNo = detail.AccountNo; } return(field); }
public bool SaveMAWBCustomized(MAWBCustomizedFiled mawbCustomizefield) { try { var detail = dbContext.MAWBCustomizeds.Find(mawbCustomizefield.MAWBCustomizedeFieldId); if (detail != null) { detail.TradelaneShipmentId = mawbCustomizefield.TradelaneShipmentId; detail.IssuingCarriersAgentNameandCity = mawbCustomizefield.IssuingCarriersAgentNameandCity; detail.DeclaredValueForCarriage = mawbCustomizefield.DeclaredValueForCarriage; detail.DeclaredValueForCustoms = mawbCustomizefield.DeclaredValueForCustoms; detail.ValuationCharge = mawbCustomizefield.ValuationCharge; detail.Tax = mawbCustomizefield.Tax; detail.TotalOtherChargesDueAgent = mawbCustomizefield.TotalOtherChargesDueAgent; detail.TotalOtherChargesDueCarrier = mawbCustomizefield.TotalOtherChargesDueCarrier; detail.OtherCharges = mawbCustomizefield.OtherCharges; detail.ChargesAtDestination = mawbCustomizefield.ChargesAtDestination; detail.TotalCollectCharges = mawbCustomizefield.TotalCollectCharges; detail.CurrencyConversionRates = mawbCustomizefield.CurrencyConversionRates; detail.TotalPrepaid = mawbCustomizefield.TotalPrepaid; detail.TotalCollect = mawbCustomizefield.TotalCollect; detail.HandlingInformation = mawbCustomizefield.HandlingInformation; detail.AgentsIATACode = mawbCustomizefield.AgentsIATACode; detail.AccountNo = mawbCustomizefield.AccountNo; dbContext.Entry(detail).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); } else { MAWBCustomized customized = new MAWBCustomized(); customized.TradelaneShipmentId = mawbCustomizefield.TradelaneShipmentId; customized.IssuingCarriersAgentNameandCity = mawbCustomizefield.IssuingCarriersAgentNameandCity; customized.DeclaredValueForCarriage = mawbCustomizefield.DeclaredValueForCarriage; customized.DeclaredValueForCustoms = mawbCustomizefield.DeclaredValueForCustoms; customized.ValuationCharge = mawbCustomizefield.ValuationCharge; customized.Tax = mawbCustomizefield.Tax; customized.TotalOtherChargesDueAgent = mawbCustomizefield.TotalOtherChargesDueAgent; customized.TotalOtherChargesDueCarrier = mawbCustomizefield.TotalOtherChargesDueCarrier; customized.OtherCharges = mawbCustomizefield.OtherCharges; customized.ChargesAtDestination = mawbCustomizefield.ChargesAtDestination; customized.TotalCollectCharges = mawbCustomizefield.TotalCollectCharges; customized.CurrencyConversionRates = mawbCustomizefield.CurrencyConversionRates; customized.TotalPrepaid = mawbCustomizefield.TotalPrepaid; customized.TotalCollect = mawbCustomizefield.TotalCollect; customized.HandlingInformation = mawbCustomizefield.HandlingInformation; customized.AgentsIATACode = mawbCustomizefield.AgentsIATACode; customized.AccountNo = mawbCustomizefield.AccountNo; dbContext.MAWBCustomizeds.Add(customized); dbContext.SaveChanges(); } return(true); } catch (DbEntityValidationException ex) { var errorMessage = ex.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage; var propertyName = ex.EntityValidationErrors.First().ValidationErrors.First().PropertyName; return(false); } }
public IHttpActionResult AddMAWBCustomized(MAWBCustomizedFiled mawbCustomizefield) { return(Ok(new TradelaneShipmentRepository().SaveMAWBCustomized(mawbCustomizefield))); }