Ejemplo n.º 1
0
        public async Task <IActionResult> Logout(string returnUrl = null)
        {
            try
            {
                var controllerValidatorCall = await this._accountControllerValidation.SignOutAsync();

                this._logger.LogInformation(controllerValidatorCall);

                if (returnUrl != null)
                {
                    return(RedirectToLocal(returnUrl));
                }
                else
                {
                    PageHeaderViewModel model = new PageHeaderViewModel()
                    {
                        BackgroundImage = "",
                        PageTitle       = "LogOut",
                        HeaderTitle     = "LogOut"
                    };

                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                this._logger.LogError(ex.Message);

                throw new ArgumentException(ex.Message);
            }
        }
        public virtual async Task <PageHeaderViewModel> GetPageHeaderViewModelAsync(
            GetStorePageHeaderViewModelParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("storepageheaderparam");
            }

            var store = await GetStoreViewModelAsync(new GetStoreParam
            {
                StoreNumber = param.StoreNumber,
                CultureInfo = param.CultureInfo,
                Scope       = param.Scope,
                BaseUrl     = param.BaseUrl
            }).ConfigureAwait(false);

            if (store == null)
            {
                return(null);
            }

            var vm = new PageHeaderViewModel
            {
                PageTitle       = GetStorePageTitle(store),
                CanonicalUrl    = GetStoreCanonicalUrl(param, store),
                MetaDescription = GetStoreMetaDescription(param, store)
            };

            return(vm);
        }
Ejemplo n.º 3
0
        public IActionResult AccessDenied()
        {
            PageHeaderViewModel model = new PageHeaderViewModel()
            {
                BackgroundImage = "",
                PageTitle       = "Access Denied",
                HeaderTitle     = "Access is Denied"
            };

            return(View(model));
        }
Ejemplo n.º 4
0
        public ActionResult About()
        {
            var obj = new PageHeaderViewModel
            {
                IsHome   = true,
                SubTitle = "This is what I do.",
                Title    = "About Me",
                Image    = "about-bg.jpg"
            };

            return(View(obj));
        }
Ejemplo n.º 5
0
        public void PageHeaderViewModelSetValuesAreCorrect()
        {
            // Arrange
            string title       = "TitleText";
            string description = "DescriptionText";
            var    target      = new PageHeaderViewModel(title, description);

            // Act and Assert
            Assert.AreNotEqual(null, target);
            Assert.AreEqual(title, target.Title);
            Assert.AreEqual(description, target.Description);
        }
Ejemplo n.º 6
0
        public IActionResult Contact()
        {
            PageHeaderViewModel returnModel =
                new PageHeaderViewModel()
            {
                BackgroundImage = "contact-bg.jpg",
                HeaderTitle     = "Contact",
                PageTitle       = "BS About Page"
            };

            return(View(returnModel));
        }
Ejemplo n.º 7
0
        public IActionResult About()
        {
            PageHeaderViewModel returnModel =
                new PageHeaderViewModel()
            {
                BackgroundImage = "about-bg.jpg",
                HeaderTitle     = "About BS",
                PageTitle       = "BS About Page"
            };

            return(View(returnModel));
        }
Ejemplo n.º 8
0
        // GET: Home
        public ActionResult Index()
        {
            var obj = new PageHeaderViewModel
            {
                IsHome      = true,
                Author      = "Trọng Khoa",
                CreatedDate = DateTime.UtcNow.ToString("dd/mm/yyy"),
                SubTitle    = "hehehehe0",
                Title       = "Cháo các bạn",
                Image       = "home-bg.jpg"
            };

            return(View(obj));
        }
Ejemplo n.º 9
0
        // GET: Contact
        public ActionResult Index()
        {
            var obj = new PageHeaderViewModel
            {
                IsHome      = true,
                Author      = "Trọng Khoa",
                CreatedDate = DateTime.UtcNow.ToString("dd/mm/yyy"),
                SubTitle    = "Have questions? I have answers.",
                Title       = "Contact Me",
                Image       = "contact-bg.jpg"
            };

            return(View(obj));
        }
Ejemplo n.º 10
0
        // GET: News
        public ActionResult Index()
        {
            var obj = new PageHeaderViewModel
            {
                IsHome      = false,
                Author      = "Trọng Khoa",
                CreatedDate = DateTime.UtcNow.ToString("dd/mm/yyy"),
                SubTitle    = "Problems look mighty small from 150 miles up",
                Title       = "Man must explore, and this is exploration at its greatest",
                Image       = "post-sample-image.jpg"
            };

            return(View(obj));
        }
Ejemplo n.º 11
0
        public virtual ActionResult PageHeader()
        {
            var page         = PageService.GetPage(SitemapNavigator.CurrentPageId);
            var canonicalUrl = page != null?UrlUtils.ToAbsolute(PageService.GetPageUrl(page.Id)) : string.Empty;

            var pageHeaderViewModel = new PageHeaderViewModel
            {
                PageTitle    = page.Title,
                NoIndex      = string.IsNullOrWhiteSpace(canonicalUrl),
                CanonicalUrl = canonicalUrl
            };

            return(View("PageHeader", pageHeaderViewModel));
        }
        public virtual Task <PageHeaderViewModel> GetPageHeaderViewModelAsync(GetPageHeaderParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }

            var pageHeaderViewModel = new PageHeaderViewModel
            {
                PageTitle = GetPageTitle(param),
                NoIndex   = !IsPageIndexed(param)
            };

            return(Task.FromResult(pageHeaderViewModel));
        }
        public async Task <IViewComponentResult> InvokeAsync(PageHeaderViewModel model)
        {
            if (ModelState.IsValid)
            {
                PageHeaderViewModel returnModel =
                    new PageHeaderViewModel()
                {
                    BackgroundImage = model.BackgroundImage,
                    HeaderTitle     = model.HeaderTitle,
                    PageTitle       = model.PageTitle
                };

                return(View("PageHeader", returnModel));
            }

            return(View());
        }
Ejemplo n.º 14
0
        public virtual PageHeaderViewModel GetPageHeaderViewModel(StoreViewModel store, GetStorePageHeaderViewModelParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (store == null)
            {
                return(null);
            }

            var vm = new PageHeaderViewModel
            {
                PageTitle       = GetStorePageTitle(store),
                CanonicalUrl    = GetStoreCanonicalUrl(param, store),
                MetaDescription = GetStoreMetaDescription(param, store)
            };

            return(vm);
        }
Ejemplo n.º 15
0
        private void SetBreadcrumb(ActionExecutingContext context)
        {
            UserInfoCache userInfoCache     = (UserInfoCache)context.HttpContext.RequestServices.GetService(typeof(UserInfoCache));
            string        CurrentController = ((Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor)context.ActionDescriptor).ControllerName;
            var           cacheMenu         = userInfoCache.GetMenuCaches();

            if (cacheMenu == null)
            {
                return;
            }
            var currentMenu = cacheMenu.Where(prop => prop.Controller == CurrentController).FirstOrDefault();

            if (currentMenu == null)
            {
                //this.PageHeader = new PageHeaderViewModel() {};
                return;
            }
            this.PageHeader = new PageHeaderViewModel()
            {
                Title = currentMenu.DisplayName,
                Path  = new List <PageHeaderPath>()
            };
            if (string.IsNullOrEmpty(currentMenu.HierarchyCode))
            {
                return;
            }
            var Paths = cacheMenu.Where(p => currentMenu.HierarchyCode.StartsWith(p.HierarchyCode)).OrderBy(p => p.HierarchyCode);

            foreach (var item in Paths)
            {
                PageHeader.Path.Add(new PageHeaderPath()
                {
                    Name       = item.Name,
                    Controller = item.Controller
                });
            }

            ViewBag.Title = Paths.Select(p => p.DisplayName).LastOrDefault();
        }