Example #1
0
        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"));
                }
            }
        }
Example #2
0
        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"));
                }
            }
        }
        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);
                }
            }
        }
Example #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);
                }
            }
        }
        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);
                    }
                }
            }
        }