From 55bf97fe533c42ffe1d34510e22a6b226be464e7 Mon Sep 17 00:00:00 2001 From: Uncled1023 Date: Sun, 2 Jul 2017 18:47:48 -0700 Subject: [PATCH] Fixed issue where exception from user info was stopping showing results in admin search. --- .../Admin/Controllers/AdminController.cs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Teknik/Areas/Admin/Controllers/AdminController.cs b/Teknik/Areas/Admin/Controllers/AdminController.cs index 9bc6641..70aa5d9 100644 --- a/Teknik/Areas/Admin/Controllers/AdminController.cs +++ b/Teknik/Areas/Admin/Controllers/AdminController.cs @@ -64,15 +64,22 @@ namespace Teknik.Areas.Admin.Controllers { foreach (Users.Models.User user in results) { - SearchResultViewModel model = new SearchResultViewModel(); - model.Username = user.Username; - if (Config.EmailConfig.Enabled) + try { - model.Email = string.Format("{0}@{1}", user.Username, Config.EmailConfig.Domain); + SearchResultViewModel model = new SearchResultViewModel(); + model.Username = user.Username; + if (Config.EmailConfig.Enabled) + { + model.Email = string.Format("{0}@{1}", user.Username, Config.EmailConfig.Domain); + } + model.JoinDate = user.JoinDate; + model.LastSeen = UserHelper.GetLastAccountActivity(db, Config, user); + models.Add(model); + } + catch (Exception ex) + { + // Skip this result } - model.JoinDate = user.JoinDate; - model.LastSeen = UserHelper.GetLastAccountActivity(db, Config, user); - models.Add(model); } }