Reputation: 31
so I'm having troubles using MVC Identity user roles as prefixes in my signalr chat.
This is jQuery inside a script tag in the view.
the view:
var admin = "@User.IsInRole("Administrator");"
// Add the message to the page.
if (admin) {
$('#discussion').append('<li class="list-group-item"><strong>' + today + ' - [Admin] - ' + htmlEncode(name) + '</strong>: ' + htmlEncode(message) + '</li>');
}
else {
$('#discussion').append('<li class="list-group-item"><strong>' + today + ' - ' + htmlEncode(name) + '</strong>: ' + htmlEncode(message) + '</li>');
}
But the thing now is when a Admin views the chat, everyone that types in chat got the Admin prefix for HIM, and opposite.
Is it any way to make this work?
Thanks for any help.
Upvotes: 0
Views: 293