谁能帮我在 2.8 版的视图中获得客户角色?我已经尝试过工作上下文,并且错误说“当前上下文中不存在工作上下文”。我在下面有以下代码,但它不起作用..
@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;
}