Beispiel #1
0
        /// <summary>
        /// Return the back office url if the back office is installed
        /// </summary>
        public static string GetBackOfficeUrl(this LinkGenerator linkGenerator, IHostingEnvironment hostingEnvironment)
        {
            Type backOfficeControllerType;

            try
            {
                backOfficeControllerType = Assembly.Load("Umbraco.Web.BackOffice")?.GetType("Umbraco.Web.BackOffice.Controllers.BackOfficeController");
                if (backOfficeControllerType == null)
                {
                    return("/"); // this would indicate that the installer is installed without the back office
                }
            }
            catch
            {
                return(hostingEnvironment.ApplicationVirtualPath); // this would indicate that the installer is installed without the back office
            }

            return(linkGenerator.GetPathByAction("Default", ControllerExtensions.GetControllerName(backOfficeControllerType), values: new { area = Cms.Core.Constants.Web.Mvc.BackOfficeApiArea }));
        }
Beispiel #2
0
 /// <summary>
 /// Returns the URL for the installer api
 /// </summary>
 public static string GetInstallerApiUrl(this LinkGenerator linkGenerator)
 => linkGenerator.GetPathByAction(
     nameof(InstallApiController.GetSetup),
     ControllerExtensions.GetControllerName <InstallApiController>(),
     new { area = Cms.Core.Constants.Web.Mvc.InstallArea }).TrimEnd(nameof(InstallApiController.GetSetup));
Beispiel #3
0
 /// <summary>
 /// Returns the URL for the installer
 /// </summary>
 public static string GetInstallerUrl(this LinkGenerator linkGenerator)
 => linkGenerator.GetPathByAction(nameof(InstallController.Index), ControllerExtensions.GetControllerName <InstallController>(), new { area = Cms.Core.Constants.Web.Mvc.InstallArea });