namespace Yes.Blog.Areas.Install.Pages { public class IndexModel(IOptionsMonitor options, IWebHostEnvironment env, IFileService fileService) : PageModel { public IActionResult OnGet() { var defaultTheme = Path.Combine(env.ContentRootPath, "files", "themes", "default"); var dir = new DirectoryInfo(defaultTheme); if (!dir.Exists) { Directory.CreateDirectory(defaultTheme); } if (dir.GetFiles().Length == 0) { var sourcePath = Path.Combine(env.WebRootPath, "themes", "default"); fileService.CopyFolder(sourcePath, defaultTheme); } var settings = options.CurrentValue; if (!string.IsNullOrEmpty(settings.ConnectionString) && !string.IsNullOrEmpty(settings.DatabaseName) && !string.IsNullOrEmpty(settings.DatabaseType)) { return Redirect("/"); } return Page(); } } }