--HG--
branch : dev
This commit is contained in:
Erik Porter
2010-02-10 16:44:50 -08:00
2 changed files with 11 additions and 4 deletions

View File

@@ -50,11 +50,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",

View File

@@ -4,6 +4,9 @@ using Orchard.Mvc.ViewModels;
namespace Orchard.Setup.ViewModels {
public class SetupViewModel : BaseViewModel {
public SetupViewModel() {
DatabaseOptions = true;
}
[Required(ErrorMessage = "Site name is required."), StringLength(70, ErrorMessage = "Site name can be no longer than 70 characters.")]
public string SiteName { get; set; }
[Required(ErrorMessage = "User name is required."), StringLengthMin(3, ErrorMessage = "User name must be longer than 3 characters."), StringLength(25, ErrorMessage = "User name can be no longer than 25 characters.")]