protected override DriverResult Editor(ProductPart part, IUpdateModel updater, dynamic shapeHelper) { //The part has already been updated by the default driver here var settings = _SKUGenerationServices.GetSettings(); var model = new AdvancedSKUProductEditorViewModel() { Product = part, Settings = settings, SkuPattern = string.IsNullOrWhiteSpace(settings.SKUPattern) ? _SKUGenerationServices.DefaultSkuPattern : settings.SKUPattern }; if (updater.TryUpdateModel(model, Prefix, null, null)) { part.Sku = model.CurrentSku; } return(ContentShape("Part_Product_SKUEdit", () => shapeHelper.EditorTemplate( TemplateName: "Parts/AdvancedSKUProduct", Model: model, Prefix: Prefix))); }
protected override DriverResult Editor(ProductPart part, dynamic shapeHelper) { var settings = _SKUGenerationServices.GetSettings(); var model = new AdvancedSKUProductEditorViewModel() { Product = part, CurrentSku = part.Sku, Settings = settings, SkuPattern = string.IsNullOrWhiteSpace(settings.SKUPattern) ? _SKUGenerationServices.DefaultSkuPattern : settings.SKUPattern }; if (string.IsNullOrWhiteSpace(part.Sku) && settings.GenerateSKUAutomatically) { part.Sku = _SKUGenerationServices.DefaultSkuPattern; } return(ContentShape("Part_Product_SKUEdit", () => shapeHelper.EditorTemplate( TemplateName: "Parts/AdvancedSKUProduct", Model: model, Prefix: Prefix))); }