public static coreModel.QuoteRequest ToCoreModel(this dataModel.QuoteRequestEntity dbEntity) { if (dbEntity == null) { throw new ArgumentNullException("dbEntity"); } var retVal = new coreModel.QuoteRequest(); retVal.InjectFrom(dbEntity); if (dbEntity.ShipmentMethodCode != null) { retVal.ShipmentMethod = new Domain.Quote.Model.ShipmentMethod { OptionName = dbEntity.ShipmentMethodOption, ShipmentMethodCode = dbEntity.ShipmentMethodCode }; } retVal.Currency = dbEntity.Currency; retVal.Addresses = dbEntity.Addresses.Select(x => x.ToCoreModel()).ToList(); retVal.Attachments = dbEntity.Attachments.Select(x => x.ToCoreModel()).ToList(); retVal.Items = dbEntity.Items.Select(x => x.ToCoreModel()).ToList(); return(retVal); }
public static coreModel.QuoteRequest ToCoreModel(this webModel.QuoteRequest quoteRequest) { var retVal = new coreModel.QuoteRequest(); retVal.InjectFrom(quoteRequest); retVal.Currency = quoteRequest.Currency; if (quoteRequest.Addresses != null) { retVal.Addresses = quoteRequest.Addresses.Select(x => x.ToCoreModel()).ToList(); } if (quoteRequest.Attachments != null) { retVal.Attachments = quoteRequest.Attachments.Select(x => x.ToCoreModel()).ToList(); } if (quoteRequest.Items != null) { retVal.Items = quoteRequest.Items.Select(x => x.ToCoreModel()).ToList(); } if (quoteRequest.DynamicProperties != null) { retVal.DynamicProperties = quoteRequest.DynamicProperties; } if (quoteRequest.Totals != null) { retVal.Totals = quoteRequest.Totals.ToCoreModel(); } if(quoteRequest.ShipmentMethod != null) { retVal.ShipmentMethod = new coreModel.ShipmentMethod(); retVal.ShipmentMethod.InjectFrom(quoteRequest.ShipmentMethod); retVal.ShipmentMethod.Currency = quoteRequest.Currency; } retVal.OperationsLog = quoteRequest.OperationsLog; return retVal; }
public static coreModel.QuoteRequest ToCoreModel(this dataModel.QuoteRequestEntity dbEntity) { if (dbEntity == null) throw new ArgumentNullException("dbEntity"); var retVal = new coreModel.QuoteRequest(); retVal.InjectFrom(dbEntity); if (dbEntity.ShipmentMethodCode != null) { retVal.ShipmentMethod = new Domain.Quote.Model.ShipmentMethod { OptionName = dbEntity.ShipmentMethodOption, ShipmentMethodCode = dbEntity.ShipmentMethodCode }; } retVal.Currency = (CurrencyCodes)Enum.Parse(typeof(CurrencyCodes), dbEntity.Currency); retVal.Addresses = dbEntity.Addresses.Select(x => x.ToCoreModel()).ToList(); retVal.Attachments = dbEntity.Attachments.Select(x => x.ToCoreModel()).ToList(); retVal.Items = dbEntity.Items.Select(x => x.ToCoreModel()).ToList(); return retVal; }
public static coreModel.QuoteRequest ToCoreModel(this webModel.QuoteRequest quoteRequest) { var retVal = new coreModel.QuoteRequest(); retVal.InjectFrom(quoteRequest); retVal.Currency = quoteRequest.Currency; if (quoteRequest.Addresses != null) { retVal.Addresses = quoteRequest.Addresses.Select(x => x.ToCoreModel()).ToList(); } if (quoteRequest.Attachments != null) { retVal.Attachments = quoteRequest.Attachments.Select(x => x.ToCoreModel()).ToList(); } if (quoteRequest.Items != null) { retVal.Items = quoteRequest.Items.Select(x => x.ToCoreModel()).ToList(); } if (quoteRequest.DynamicProperties != null) { retVal.DynamicProperties = quoteRequest.DynamicProperties; } if (quoteRequest.Totals != null) { retVal.Totals = quoteRequest.Totals.ToCoreModel(); } if (quoteRequest.ShipmentMethod != null) { retVal.ShipmentMethod = new coreModel.ShipmentMethod(); retVal.ShipmentMethod.InjectFrom(quoteRequest.ShipmentMethod); retVal.ShipmentMethod.Currency = quoteRequest.Currency; } retVal.OperationsLog = quoteRequest.OperationsLog; return(retVal); }