Can anyone help me get customer role on a view in version 2.8? I have tried workcontext, and error says “workcontext does not exist in the current context”. I have the following code below, but it does not work..
@model BoardsIndexModel
@using Nop.Core.Infrastructure;
@using Nop.Services.Helpers;
@using Nop.Web.Models.Boards;
@using Nop.Core.Domain.Customers;
@using Nop.Services.Customers;
@if (Roles.IsUserInRole("Administrators"))
{
Do that;
}
else
{
Do this;
}
This is how I did it, with the help of a nice person on the nopcommerce forum: