Patch ACL.UserLink

Assume system user if no user matching the ID was found.
This commit is contained in:
Michael 2017-04-04 18:54:59 -04:00
parent 35aa49e73f
commit 303ef44a18

View file

@ -113,7 +113,8 @@ public static IHtmlString UserLink(this HtmlHelper hpr, string userId)
using(var db = new ApplicationDbContext())
{
var usr = db.Users.Include(x=>x.Roles).FirstOrDefault(x => x.Id == userId);
if (usr == null)
return hpr.Raw("<a href=\"#\">system</a>");
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{