Reputation: 3
@if (User.IsInRole("Admin")) {
//Link goes here.
}
That all works fine and dandy but what do I do when I would like to allow multiply roles such as:
@if (User.IsInRole("Admin, SuperUser")) {
//Link goes here.
}
Upvotes: 0
Views: 2354
Reputation: 1150
You should use the conditional-OR operator (||). See Microsoft documentation here: https://msdn.microsoft.com/en-us/library/6373h346.aspx
@if (User.IsInRole("Admin") || User.IsInRole("SuperUser") {
//Link goes here.
}
Upvotes: 3