Exemple #1
0
        public IActionResult StepTwo(StepTwoModel model)
        {
            if (!CheckStep(2))
            {
                return(Redirect("1"));
            }

            var countries = new CountryHelper().GetCountryData();

            if (ModelState.IsValid)
            {
                var country = countries.Where(c => c.CountryShortCode == model.CountryCode);
                if (country.Any())
                {
                    GlobalSettings.Store("CONFIG_CompanyName", model.CompanyName);
                    GlobalSettings.Store("CONFIG_CompanySubject", model.CompanyName);
                    GlobalSettings.Store("CONFIG_CompanyCountryCode", country.First().CountryShortCode);
                    GlobalSettings.Store("CONFIG_URL", model.AppHost);

                    Helpers.ReplaceEnvVariableInFile(GlobalSettings.Get("CONFIG_FILE"), "SP_CONFIG_SETUPASSISTANT_STEP", "3");
                    GlobalSettings.Store("CONFIG_SETUPASSISTANT_STEP", "3");

                    return(Redirect("3"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Unknown country");
                }
            }

            model.CountryList = new Microsoft.AspNetCore.Mvc.Rendering.SelectList(countries, "CountryShortCode", "CountryName");

            return(View(model));
        }
Exemple #2
0
        public IActionResult StepTwo()
        {
            if (!CheckStep(2))
            {
                return(Redirect("1"));
            }

            var companyName = GlobalSettings.Get("CONFIG_CompanyName");
            var appHost     = GlobalSettings.Get("CONFIG_URL");

            StepTwoModel model = new StepTwoModel();

            model.CompanyName = companyName != null ? companyName : "";
            model.AppHost     = appHost != null ? appHost : Request.Host.ToString();

            var countries = new CountryHelper().GetCountryData();

            model.CountryList = new Microsoft.AspNetCore.Mvc.Rendering.SelectList(countries, "CountryShortCode", "CountryName");

            return(View(model));
        }