Exemplo n.º 1
0
        public IActionResult Index()
        {
            var model = new InstallationModel
            {
                AdminEmail = _installService.GetResource("AdminEmailValue")
            };

            var curLanguage = _installService.GetCurrentLanguage();

            var installLanguages = _installService.GetInstallationLanguages()
                                   .Select(x =>
            {
                return(new SelectListItem
                {
                    Value = Url.Action("ChangeLanguage", "Install", new { language = x.Code }),
                    Text = x.Name,
                    Selected = curLanguage.Code == x.Code
                });
            })
                                   .ToList();

            var appLanguages = _installService.GetAppLanguages()
                               .Select(x =>
            {
                return(new SelectListItem
                {
                    Value = x.Culture,
                    Text = x.Name,
                    Selected = x.UniqueSeoCode.EqualsNoCase(curLanguage.Code)
                });
            })
                               .ToList();

            if (!appLanguages.Any(x => x.Selected))
            {
                appLanguages.FirstOrDefault(x => x.Value.EqualsNoCase("en")).Selected = true;
            }

            ViewBag.AvailableInstallationLanguages = installLanguages;
            ViewBag.AvailableAppLanguages          = appLanguages;

            ViewBag.AvailableMediaStorages = new[]
            {
                new SelectListItem {
                    Value = "fs", Text = _installService.GetResource("MediaStorage.FS"), Selected = true
                },
                new SelectListItem {
                    Value = "db", Text = _installService.GetResource("MediaStorage.DB")
                }
            };

            return(View(model));
        }