Changed the default value for SetupViewModel to be the built-in database option and added a check to ensure a connection string was entered when the sql database option is checked

--HG--
branch : dev
This commit is contained in:
Erik Porter
2010-02-10 16:40:58 -08:00
parent 41ba3009e9
commit d3e35ff0a5
2 changed files with 13 additions and 5 deletions

View File

@@ -46,11 +46,15 @@ namespace Orchard.Setup.Controllers {
[HttpPost, ActionName("Index")]
public ActionResult IndexPOST(SetupViewModel model) {
try {
if (!ModelState.IsValid) {
return Index(model);
}
//HACK: (erikpo) Couldn't get a custom ValidationAttribute to validate two properties
if (!model.DatabaseOptions && string.IsNullOrEmpty(model.DatabaseConnectionString))
ModelState.AddModelError("DatabaseConnectionString", "A SQL connection string is required");
if (!ModelState.IsValid) {
return Index(model);
}
try {
var shellSettings = new ShellSettings {
Name = "default",
DataProvider = model.DatabaseOptions ? "SQLite" : "SqlServer",