Example #1
0
        public ActionResult SetupDatabase()
        {
            if (!installService.ShoulDatabaseBeSet())
            {
                throw new HttpException(403, "Database is already installed!");
            }

            var model = new SetupDatabaseViewModel();

            return(View(model));
        }
        public bool Execute(SetupDatabaseViewModel request)
        {
            if (installService.ShoulDatabaseBeSet())
            {
                string connectionString;
                if (request.CreateDatabase)
                {
                    connectionString = installService.CreateDatabase(request);
                }
                else
                {
                    connectionString = installService.TestConnectionString(request);
                }

                installService.SaveConnectionString(connectionString);

                return(true);
            }

            return(false);
        }