public IViewComponentResult Invoke()
        {
            //get image base url to add it to the relative url
            var imageBaseURL      = _configuration.GetValue <string>("BackEndDomain");
            var homePageBasicInfo = _hP_BasicInfoReopsitory.GetAll().FirstOrDefault();

            if (homePageBasicInfo.FavIconUrl != null)
            {
                homePageBasicInfo.FavIconUrl = imageBaseURL + homePageBasicInfo.FavIconUrl.Replace(" ", "%20");
            }
            if (homePageBasicInfo.LogoUrl != null)
            {
                homePageBasicInfo.LogoUrl = imageBaseURL + homePageBasicInfo.LogoUrl.Replace(" ", "%20");
            }

            ViewBag.FavIconUrl  = homePageBasicInfo.FavIconUrl;
            ViewBag.LogoUrl     = homePageBasicInfo.LogoUrl;
            FavIcon.FavIconLink = homePageBasicInfo.FavIconUrl;
            var contactUs = _dataAccessService.PageContact.FirstOrDefault();
            var items1    = _dataAccessService.NavItems.Where(x => !x.IsDeleted && x.IsActive).OrderBy(i => i.Order).ThenByDescending(i => i.CreationDate).ToList();

            foreach (var item1 in items1)
            {
                item1.PageRoutes = _dataAccessService.PageRoutes.Where(i => i.NavItemId == item1.Id && !i.IsDeleted && i.IsActive && (!i.IsDynamicPage || i.PageSections.Any(x => !x.IsDeleted && x.IsActive))).OrderBy(x => x.Order).ThenByDescending(x => x.CreationDate).ToList();
            }
            ViewBag.ContactUsAr = contactUs.ArPageName;
            ViewBag.ContactUsEn = contactUs.EnPageName;

            return(View(items1));
        }
Пример #2
0
        /// <summary>
        /// get home page index
        /// </summary>
        /// <param name="lang"></param>
        /// <returns></returns>
        public IActionResult Index(string lang)
        {
            //get current domain to use it in SEO link in image
            var CurrentDomain = _configuration.GetValue <string>("CurrentDomain");
            var imageBaseURL  = _configuration.GetValue <string>("BackEndDomain");

            ViewBag.PageName = "HomePage";
            var homePageBasicInfo = _hP_BasicInfoReopsitory.GetAll().FirstOrDefault();

            ViewBag.FavIconUrl = imageBaseURL + homePageBasicInfo.FavIconUrl;
            SetUpSEO(lang, new Data.PageRoute()
            {
                SeoDescriptionAR = homePageBasicInfo.SeoDescriptionAR,
                SeoDescriptionEN = homePageBasicInfo.SeoDescriptionEN,
                SeoOgTitleAR     = homePageBasicInfo.SeoOgTitleAR,
                SeoOgTitleEN     = homePageBasicInfo.SeoOgTitleEN,
                SeoTwitterCardAR = homePageBasicInfo.SeoTwitterCardAR,
                SeoTwitterCardEN = homePageBasicInfo.SeoTwitterCardEN
            }, CurrentDomain, CurrentDomain + "/EgyptFlag.jpg");
            if (lang == null || lang.Equals("ar"))
            {
                ViewData["Title"] = "الرئيسية";
            }
            else
            {
                ViewData["Title"] = "Home";
            }


            return(View());
        }
        public IActionResult Edit()
        {
            var basicInfo = _hP_BasicInfoReopsitory.GetAll().FirstOrDefault();

            return(View(basicInfo.MapToViewModel()));
        }