@if (User.IsInRole("Admin")) {
//Link goes here.
}
这一切都很好用,但是当我想允许多重角色时我该怎么做:
@if (User.IsInRole("Admin, SuperUser")) {
//Link goes here.
}
答案 0 :(得分:3)
您应该使用条件OR运算符(||)。 请参阅此处的Microsoft文档:https://msdn.microsoft.com/en-us/library/6373h346.aspx
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
/**other elements here**/
</LinearLayout>
</android.support.v4.widget.NestedScrollView>