Example #1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            string imageURL             = HttpContextCommons.HostURL + "/images/logos/dashboard/Contentder.jpg";
            string dashboardImageFolder = Path.Combine(CurrentHostEnvironment.WebRootPath, "images", "logos", "dashboard");

            if (Directory.Exists(dashboardImageFolder) && Directory.GetFiles(dashboardImageFolder).Length > 0)
            {
                string imagePath = Directory.GetFiles(dashboardImageFolder)[0];
                imagePath = imagePath.Replace(CurrentHostEnvironment.WebRootPath, string.Empty).Replace("\\", "/");
                imageURL  = HttpContextCommons.HostURL + imagePath;
            }

            if (HttpContextCommons.LocalizationEnabled)
            {
                WebBuilderController webBuilderController = new WebBuilderController();
                ViewBag.Languages = await webBuilderController.GetLanguageLists(SiteID);

                SettingHelper settingHelper = new SettingHelper(_memoryCache);
                ViewBag.DefaultLanguage = settingHelper.GetCachedSettingValue(SettingKeys.CultureLanguage);
            }
            ViewBag.DropdownURL = HostUrl + "/dashboard/" + PageName + "/" + ActionName + "/";
            ViewBag.ImageURL    = imageURL;
            return(await Task.FromResult((IViewComponentResult)View("Default")));
        }