protected virtual void UpdateLocales(PredefinedArticleAttributeValue ppav, PredefinedArticleAttributeValueModel model) { foreach (var localized in model.Locales) { _localizedEntityService.SaveLocalizedValue(ppav, x => x.Name, localized.Name, localized.LanguageId); } }
/// <summary> /// Updates the predefined article attribute value /// </summary> /// <param name="ppav">The predefined article attribute value</param> public virtual void UpdatePredefinedArticleAttributeValue(PredefinedArticleAttributeValue ppav) { if (ppav == null) { throw new ArgumentNullException("ppav"); } _predefinedArticleAttributeValueRepository.Update(ppav); //cache _cacheManager.RemoveByPattern(ARTICLEATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(ARTICLEATTRIBUTEMAPPINGS_PATTERN_KEY); _cacheManager.RemoveByPattern(ARTICLEATTRIBUTEVALUES_PATTERN_KEY); _cacheManager.RemoveByPattern(ARTICLEATTRIBUTECOMBINATIONS_PATTERN_KEY); //event notification _eventPublisher.EntityUpdated(ppav); }
public virtual ActionResult PredefinedArticleAttributeValueCreatePopup(string btnId, string formId, PredefinedArticleAttributeValueModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes)) { return(AccessDeniedView()); } var articleAttribute = _articleAttributeService.GetArticleAttributeById(model.ArticleAttributeId); if (articleAttribute == null) { throw new ArgumentException("No article attribute found with the specified id"); } if (ModelState.IsValid) { var ppav = new PredefinedArticleAttributeValue { ArticleAttributeId = model.ArticleAttributeId, Name = model.Name, PriceAdjustment = model.PriceAdjustment, WeightAdjustment = model.WeightAdjustment, Cost = model.Cost, IsPreSelected = model.IsPreSelected, DisplaySubscription = model.DisplaySubscription }; _articleAttributeService.InsertPredefinedArticleAttributeValue(ppav); UpdateLocales(ppav, model); ViewBag.RefreshPage = true; ViewBag.btnId = btnId; ViewBag.formId = formId; return(View(model)); } //If we got this far, something failed, redisplay form return(View(model)); }