public ActionResult Culture() { //todo: class and/or method attributes for our auth? if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage settings"))) { return(new HttpUnauthorizedResult()); } var model = new SiteCulturesViewModel { CurrentCulture = _cultureManager.GetCurrentCulture(HttpContext), SiteCultures = _cultureManager.ListCultures(), }; model.AvailableSystemCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures) .Select(ci => ci.Name) .Where(s => !model.SiteCultures.Contains(s)); return(View(model)); }
public async Task <IActionResult> Culture() { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageSettings)) { return(Unauthorized()); } var siteSettings = await _siteService.GetSiteSettingsAsync(); var model = new SiteCulturesViewModel { CurrentCulture = siteSettings.Culture, SiteCultures = siteSettings.SupportedCultures }; model.AvailableSystemCultures = CultureInfo.GetCultures(CultureTypes.AllCultures) .Select(ci => CultureInfo.GetCultureInfo(ci.Name)) .Where(s => !model.SiteCultures.Contains(s.Name)); return(View(model)); }