Updated 15 classes to use the new TryGetUmbracoContext and implemented a Set() method in HybridUmbracoContextAccessor

This commit is contained in:
Zeegaan
2021-08-11 13:25:17 +02:00
parent c3bac00f6e
commit f299c6a93b
15 changed files with 73 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
@@ -23,7 +23,11 @@ namespace Umbraco.Cms.Web.Website.Controllers
public ActionResult Index()
{
var store = _umbracoContextAccessor.UmbracoContext.Content;
if (!_umbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
{
throw new InvalidOperationException("Wasn't able to get an UmbracoContext");
}
var store = umbracoContext.Content;
if (store.HasContent())
{
// If there is actually content, go to the root.