コード例 #1
0
ファイル: HomeController.cs プロジェクト: viraj99/sio.core
        public async System.Threading.Tasks.Task <IActionResult> Page(
            string culture, string seoName)
        {
            if (_forbidden)
            {
                return(Redirect($"/error/403"));
            }
            if (SioService.GetConfig <bool>("IsMaintenance"))
            {
                return(Redirect($"/maintenance"));
            }

            if (SioService.GetConfig <bool>("IsInit"))
            {
                //Go to landing page
                return(await PageAsync(seoName));
            }
            else
            {
                if (string.IsNullOrEmpty(SioService.GetConnectionString(SioConstants.CONST_CMS_CONNECTION)))
                {
                    return(Redirect("Init"));
                }
                else
                {
                    return(Redirect($"/init/step2"));
                }
            }
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: viraj99/sio.core
        public async System.Threading.Tasks.Task <IActionResult> Alias(string culture,
                                                                       string alias, int pageIndex, int pageSize = 10)
        {
            string seoName = Request.Query["alias"];

            seoName = seoName ?? alias;
            if (_forbidden)
            {
                return(Redirect($"/error/403"));
            }
            if (SioService.GetConfig <bool>("IsMaintenance"))
            {
                return(Redirect($"/maintenance"));
            }

            if (SioService.GetConfig <bool>("IsInit"))
            {
                //Go to landing page
                return(await AliasAsync(seoName));
            }
            else
            {
                if (string.IsNullOrEmpty(SioService.GetConnectionString(SioConstants.CONST_CMS_CONNECTION)))
                {
                    return(Redirect("Init"));
                }
                else
                {
                    return(Redirect($"/init/step2"));
                }
            }
        }
コード例 #3
0
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            string cnn = SioService.GetConnectionString(SioConstants.CONST_CMS_CONNECTION);

            if (!string.IsNullOrEmpty(cnn))
            {
                if (SioService.GetConfig <bool>("IsSqlite"))
                {
                    optionsBuilder.UseSqlite(cnn);
                }
                else
                {
                    optionsBuilder.UseSqlServer(cnn);
                }
            }
        }
コード例 #4
0
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            string cnn = SioService.GetConnectionString(SioConstants.CONST_CMS_CONNECTION);

            if (!string.IsNullOrEmpty(cnn))
            {
                if (SioService.GetConfig <int>(SioConstants.CONST_SETTING_DATABASE_PROVIDER) == (int)SioEnums.DatabaseProvider.MySQL)
                {
                    optionsBuilder.UseMySQL(cnn);
                }
                else
                {
                    optionsBuilder.UseSqlServer(cnn);
                }
            }
        }
コード例 #5
0
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                //define the database to use
                //string cnn = "Data Source=sio-messenger.db";
                //optionsBuilder.UseSqlite(cnn);
                ;
                // IConfiguration configuration = new ConfigurationBuilder()
                //.SetBasePath(System.IO.Directory.GetCurrentDirectory())
                //.AddJsonFile(Common.Utility.Const.CONST_FILE_APPSETTING)
                //.Build();

                // //optionsBuilder.UseSqlServer(cnn);
                // string cnn = configuration.GetConnectionString("SioMessengerConnection");
                // if (string.IsNullOrEmpty(cnn))
                // {
                //     cnn = _cnn;
                // }
                // //define the database to use
                // if (!string.IsNullOrEmpty(cnn))
                // {
                //         optionsBuilder.UseSqlServer(cnn);
                // }

                string cnn = SioService.GetConnectionString(SioConstants.CONST_CMS_CONNECTION);
                if (!string.IsNullOrEmpty(cnn))
                {
                    if (SioService.GetConfig <bool>("IsSqlite"))
                    {
                        optionsBuilder.UseSqlite(cnn);
                    }
                    else
                    {
                        optionsBuilder.UseSqlServer(cnn);
                    }
                }
            }
        }