2010-02-04 12:24:18 -08:00
|
|
|
|
using System.Web.Mvc;
|
2010-02-05 15:29:49 -08:00
|
|
|
|
using Orchard.Setup.ViewModels;
|
2010-02-04 12:24:18 -08:00
|
|
|
|
using Orchard.Localization;
|
2010-02-05 13:36:01 -08:00
|
|
|
|
using Orchard.UI.Notify;
|
2010-02-04 12:24:18 -08:00
|
|
|
|
|
2010-02-05 15:29:49 -08:00
|
|
|
|
namespace Orchard.Setup.Controllers {
|
2010-02-04 12:24:18 -08:00
|
|
|
|
public class SetupController : Controller {
|
2010-02-05 13:36:01 -08:00
|
|
|
|
private readonly INotifier _notifier;
|
2010-02-04 12:24:18 -08:00
|
|
|
|
|
2010-02-05 13:36:01 -08:00
|
|
|
|
public SetupController(INotifier notifier) {
|
|
|
|
|
_notifier = notifier;
|
2010-02-04 12:24:18 -08:00
|
|
|
|
T = NullLocalizer.Instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Localizer T { get; set; }
|
|
|
|
|
|
|
|
|
|
public ActionResult Index() {
|
2010-02-05 13:36:01 -08:00
|
|
|
|
return View(new SetupViewModel { AdminUsername = "admin" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult Index(SetupViewModel model) {
|
|
|
|
|
TryUpdateModel(model);
|
|
|
|
|
|
|
|
|
|
if (!ModelState.IsValid) {
|
|
|
|
|
return View(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// create superuser
|
|
|
|
|
// set site name
|
|
|
|
|
// database
|
|
|
|
|
// redirect to the welcome page
|
|
|
|
|
|
|
|
|
|
_notifier.Information(T("Setup succeeded"));
|
|
|
|
|
return RedirectToAction("Index");
|
2010-02-04 12:24:18 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|