ACL profile query bug.

This commit is contained in:
Michael 2017-03-21 13:01:55 -04:00
parent 32d02caddf
commit 4654aaea6b

View file

@ -29,8 +29,8 @@ public static IHtmlString UserLink(this HtmlHelper hpr, string userId)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
return hpr.ActionLink(usr.DisplayName, "ViewProfile", "Profiles", new { name = usr.UserName }, new { style = @"color: " + userRole.ColorHex });
var userRole = userRoles.OrderByDescending(m => m.Priority).FirstOrDefault();
return hpr.ActionLink(usr.DisplayName, "ViewProfile", "Profiles", new { name = usr.UserName }, new { style = userRole == null ? "color:white;" : @"color: " + userRole.ColorHex });
}
}