More work on the MT UI

- added suspend/resume actions

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-05-11 16:14:18 -07:00
parent 2d24ef8543
commit 5aad2aa8ab
7 changed files with 60 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Web.Mvc;
using Orchard.Environment.Configuration;
using Orchard.Localization;
@@ -51,5 +52,35 @@ namespace Orchard.MultiTenancy.Controllers {
return View(viewModel);
}
}
[HttpPost]
public ActionResult Disable(ShellSettings shellSettings) {
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Couldn't disable tenant")))
return new HttpUnauthorizedResult();
var tenant = _tenantService.GetTenants().FirstOrDefault(ss => ss.Name == shellSettings.Name);
if (tenant != null) {
tenant.State.CurrentState = TenantState.State.Disabled;
_tenantService.UpdateTenant(tenant);
}
return RedirectToAction("index");
}
[HttpPost]
public ActionResult Enable(ShellSettings shellSettings) {
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Couldn't enable tenant")))
return new HttpUnauthorizedResult();
var tenant = _tenantService.GetTenants().FirstOrDefault(ss => ss.Name == shellSettings.Name);
if (tenant != null) {
tenant.State.CurrentState = TenantState.State.Running;
_tenantService.UpdateTenant(tenant);
}
return RedirectToAction("index");
}
}
}