mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Updating SetupController to work with new [Required] attribute behavior
GET method no longer takes model as an argument see also http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html --HG-- branch : dev
This commit is contained in:
@@ -35,7 +35,7 @@ namespace Orchard.Setup.Controllers {
|
||||
|
||||
private Localizer T { get; set; }
|
||||
|
||||
public ActionResult Index(SetupViewModel model) {
|
||||
private ActionResult IndexViewResult(SetupViewModel model) {
|
||||
string message = "";
|
||||
if (!CanWriteToAppDataFolder(out message)) {
|
||||
_notifier.Error(
|
||||
@@ -44,7 +44,11 @@ namespace Orchard.Setup.Controllers {
|
||||
message));
|
||||
}
|
||||
|
||||
return View(model ?? new SetupViewModel { AdminUsername = "admin" });
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public ActionResult Index() {
|
||||
return IndexViewResult(new SetupViewModel { AdminUsername = "admin" });
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
@@ -54,7 +58,7 @@ namespace Orchard.Setup.Controllers {
|
||||
ModelState.AddModelError("DatabaseConnectionString", "A SQL connection string is required");
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
return Index(model);
|
||||
return IndexViewResult(model);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -129,7 +133,7 @@ namespace Orchard.Setup.Controllers {
|
||||
}
|
||||
catch (Exception exception) {
|
||||
_notifier.Error(T("Setup failed: " + exception.Message));
|
||||
return Index(model);
|
||||
return IndexViewResult(model);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user