From 4954f3a7813eb12c08ac9200e784750bc7e6d670 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 12 Mar 2012 14:48:14 -0700 Subject: [PATCH] #18501: Redirecting to Layers managements when trying to access Widgets with no layers configured Work Item: 18501 --HG-- branch : 1.x --- .../Modules/Orchard.Widgets/Controllers/AdminController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs index 526d26f90..56fc03bb5 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs @@ -51,10 +51,11 @@ namespace Orchard.Widgets.Controllers { dynamic Shape { get; set; } public ActionResult Index(int? layerId) { - IEnumerable layers = _widgetsService.GetLayers(); + IEnumerable 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