#18501: Redirecting to Layers managements when trying to access Widgets with no layers configured

Work Item: 18501

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-03-12 14:48:14 -07:00
parent dd19aed5af
commit 4954f3a781

View File

@@ -51,10 +51,11 @@ namespace Orchard.Widgets.Controllers {
dynamic Shape { get; set; }
public ActionResult Index(int? layerId) {
IEnumerable<LayerPart> layers = _widgetsService.GetLayers();
IEnumerable<LayerPart> layers = _widgetsService.GetLayers().ToList();
if (layers.Count() == 0) {
if (!layers.Any()) {
Services.Notifier.Error(T("There are no widget layers defined. A layer will need to be added in order to add widgets to any part of the site."));
return RedirectToAction("AddLayer");
}
LayerPart currentLayer = layerId == null