示例#1
0
        public ActionResult Index()
        {
            bool easyInstall = System.Configuration.ConfigurationManager.AppSettings["EasyInstall"].ToLowerInvariant() == "true";

            if (!easyInstall)
            {
                return(this.Failed("Access is denied. In order to use this feature, please enter a key named EasyInstall with value true on Web.config/AppSettings.", System.Net.HttpStatusCode.Conflict));
            }

            if (!Directory.Exists(HostingEnvironment.MapPath("~/Resources/_Configs")))
            {
                return(this.Failed("Cannot continue. The configuration template directory: /Resources/_Configs was not found.", System.Net.HttpStatusCode.Conflict));
            }

            var model = EasyInstallConfigFile.Get();

            if (model == null)
            {
                model = new InstallViewModel
                {
                    DomainName   = this.Request.Url.Host,
                    DatabaseName = ByConvention.ConvertToTenantName(this.Request.Url.Host),
                    SqlServer    = new SqlServerConfig(),
                    PostgreSQL   = new PostgreSQLConfig()
                };
            }

            return(this.View("~/Views/EasyInstall.cshtml", model));
        }
示例#2
0
        public static string WriteConfig()
        {
            var model = EasyInstallConfigFile.Get();

            return(ConfigWriter.WriteConfig(model));
        }
示例#3
0
        public static string TestSqlServer()
        {
            var model = EasyInstallConfigFile.Get();

            return(SqlServerConnectionTester.Test(model.SqlServer));
        }
示例#4
0
        public static string TestRedis()
        {
            var model = EasyInstallConfigFile.Get();

            return(RedisConnectionTester.Test(model.RedisConnectionString));
        }
示例#5
0
        public static string TestPostgreSQL()
        {
            var model = EasyInstallConfigFile.Get();

            return(PostgreSQLConnectionTester.Test(model.PostgreSQL));
        }