From 4c680f5a372e6a5adffaae1454432392fc68a847 Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Sun, 5 Apr 2020 16:05:38 +0300 Subject: [PATCH] Added redirect from blank art details page --- MyWebsite/MyWebsite/Controllers/GalleryController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MyWebsite/MyWebsite/Controllers/GalleryController.cs b/MyWebsite/MyWebsite/Controllers/GalleryController.cs index 4d171d3..7eea2c4 100644 --- a/MyWebsite/MyWebsite/Controllers/GalleryController.cs +++ b/MyWebsite/MyWebsite/Controllers/GalleryController.cs @@ -12,6 +12,8 @@ namespace MyWebsite.Controllers View(new ArtworkViewModel(Database)); public IActionResult Details(string id) => + string.IsNullOrWhiteSpace(id) ? + (IActionResult)RedirectToAction("Index") : View(new ArtworkViewModel(Database, id)); } } \ No newline at end of file