mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 13:33:34 +08:00
More work on the MT UI
- added suspend/resume actions --HG-- branch : dev
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user