/// <summary> /// Prepare shipping method model /// </summary> /// <param name="model">Shipping method model</param> /// <param name="shippingMethod">Shipping method</param> /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param> /// <returns>Shipping method model</returns> public virtual ShippingMethodModel PrepareShippingMethodModel(ShippingMethodModel model, ShippingMethod shippingMethod, bool excludeProperties = false) { Action <ShippingMethodLocalizedModel, int> localizedModelConfiguration = null; if (shippingMethod != null) { //fill in model values from the entity model = model ?? shippingMethod.ToModel(); //define localized model configuration action localizedModelConfiguration = (locale, languageId) => { locale.Name = shippingMethod.GetLocalized(entity => entity.Name, languageId, false, false); locale.Description = shippingMethod.GetLocalized(entity => entity.Description, languageId, false, false); }; } //prepare localized models if (!excludeProperties) { model.Locales = _localizedModelFactory.PrepareLocalizedModels(localizedModelConfiguration); } return(model); }