Fantastiska
fläder

Äntligen blommar den fantastiska flädern! Fläderblommorna kan du hitta i juni-juli och i augusti blir fläderbären mogna. Av både fläderblommorna och fläderbären kan du göra massvis med gott – och dessutom är det väldigt lätt att göra. Här har vi samlat alla våra fantastiska fläderrecept!

Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81

Visste du detta om fläder

Fläder (Sambucus nigra) växer både i trädgårdar och i vilt tillstånd. Förekommer från Skåne till Jämtland och Ångermanland. Den äkta flädern som blommar i juni med stora gulvita blomställningar används till saft, marmelad och desserter. Även de svarta bären kan användas till saft och sylt. Den vilda druvflädern däremot, får korallröda bär och är inte ätlig. Långt tillbaka i tiden ansågs flädern vara helig, man trodde att Freja bodde i flädern och brukade åkalla henne vid trassliga kärleksaffärer. Flädern användes förr som medicinalväxt och som te. Än idag används den till te men i huvudsak till saft.

Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81

Har du några frågor rörande våra produkter, recept eller annat så svarar vi gärna.

Baka med sommarens bär

Baka med sommarens bär och bjud på något hembakat till kalaset.

Magiskt god Morotsbulle med frosting

Elsa Billgren och Sofia Wood har tagit fram ett helt nytt bakverk som är härligt saftigt, goffigt, kryddigt och alldeles underbart. Ett recept du inte vill missa!

Härliga jordgubbstider

Låt dig inspireras av våra recept med jordgubbar som ingrediens.

Gör din egen glass

Här har vi samlat våra bästa glassrecept, men experimentera gärna fram dina egna favoriter!

Syltskolan

I vår Syltskola hittar du alla tips om hur du kokar sylt, frågor och svar och recept.

Sommardesserter

När det är varmt är det extra gott att bjuda på en sötsyrlig och fräsch sommardessert som avslutning på grillkvällen eller sommarfesten.