public void Can_save_and_load_shippingMethod() { var shippingMethod = new ShippingMethod { Name = "Name 1", Description = "Description 1", DisplayOrder = 1 }; var fromDb = SaveAndLoadEntity(shippingMethod); fromDb.ShouldNotBeNull(); fromDb.Name.ShouldEqual("Name 1"); fromDb.Description.ShouldEqual("Description 1"); fromDb.DisplayOrder.ShouldEqual(1); }
protected virtual void UpdateLocales(ShippingMethod shippingMethod, ShippingMethodModel model) { foreach (var localized in model.Locales) { _localizedEntityService.SaveLocalizedValue(shippingMethod, x => x.Name, localized.Name, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(shippingMethod, x => x.Description, localized.Description, localized.LanguageId); } }
public void Can_save_and_load_shippingMethod_with_restriction() { var shippingMethod = new ShippingMethod { Name = "Name 1", DisplayOrder = 1 }; shippingMethod.RestrictedCountries.Add(GetTestCountry()); var fromDb = SaveAndLoadEntity(shippingMethod); fromDb.ShouldNotBeNull(); fromDb.RestrictedCountries.ShouldNotBeNull(); (fromDb.RestrictedCountries.Count == 1).ShouldBeTrue(); fromDb.RestrictedCountries.First().Name.ShouldEqual("United States"); }
/// <summary> /// Updates the shipping method /// </summary> /// <param name="shippingMethod">Shipping method</param> public virtual void UpdateShippingMethod(ShippingMethod shippingMethod) { if (shippingMethod == null) throw new ArgumentNullException("shippingMethod"); _shippingMethodRepository.Update(shippingMethod); //event notification _eventPublisher.EntityUpdated(shippingMethod); }
public static ShippingMethod ToEntity(this ShippingMethodModel model, ShippingMethod destination) { return Mapper.Map(model, destination); }
/// <summary> /// Updates the shipping method /// </summary> /// <param name="shippingMethod">Shipping method</param> public virtual void UpdateShippingMethod(ShippingMethod shippingMethod) { if (shippingMethod == null) throw new ArgumentNullException("shippingMethod"); _shippingMethodRepository.Update(shippingMethod); _cacheManager.RemoveByPattern(SHIPPINGMETHODS_PATTERN_KEY); //event notification _eventPublisher.EntityUpdated(shippingMethod); }
protected virtual List<LocalizedProperty> UpdateLocales(ShippingMethod shippingMethod, ShippingMethodModel model) { List<LocalizedProperty> localized = new List<LocalizedProperty>(); foreach (var local in model.Locales) { localized.Add(new LocalizedProperty() { LanguageId = local.LanguageId, LocaleKey = "Name", LocaleValue = local.Name }); localized.Add(new LocalizedProperty() { LanguageId = local.LanguageId, LocaleKey = "Description", LocaleValue = local.Description }); } return localized; }