示例#1
0
        public async Task <IActionResult> Index(string culture)
        {
            if (!string.IsNullOrEmpty(culture))
            {
                Response.Cookies.Append(
                    CookieRequestCultureProvider.DefaultCookieName,
                    CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
                    new CookieOptions {
                    Expires = DateTimeOffset.UtcNow.AddYears(1)
                }
                    );
            }

            if (User.Identity.IsAuthenticated)
            {
                return(View("IndexAuthenticated"));
            }

            var sessionId = GetSession();

            var viewModel = new IndexPageModel
            {
                BrowserSession = await _browserSessionsRepository.GetSessionAsync(sessionId)
            };

            return(View(viewModel));
        }
示例#2
0
        public async Task <ActionResult> Index(string langId)
        {
            if (langId != null)
            {
                this.SetLanguage(langId);
            }

            var sessionId = this.GetSession();

            var viewModel = new IndexPageModel
            {
                BrowserSession = await _browserSessionsRepository.GetSessionAsync(sessionId)
            };

            return(View(viewModel));
        }