From b369eaa11ba0e974da4945df314f4fd56f9e43cc Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 28 Mar 2011 10:27:35 -0700 Subject: [PATCH] Making sure the global widget admin page is still usable when no layers are defined. work item: 17538 --HG-- branch : 1.x --- .../Modules/Orchard.Widgets/Controllers/AdminController.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs index 0f7207702..d3b1f5479 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs @@ -54,12 +54,11 @@ namespace Orchard.Widgets.Controllers { IEnumerable layers = _widgetsService.GetLayers(); if (layers.Count() == 0) { - Services.Notifier.Error(T("Layer not found: {0}", layerId)); - return RedirectToAction("Index"); + 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.")); } LayerPart currentLayer = layerId == null - ? layers.First() + ? layers.FirstOrDefault() : layers.FirstOrDefault(layer => layer.Id == layerId); if (currentLayer == null && layerId != null) { // Incorrect layer id passed