You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.9 KiB

@using Infrastructure.Configuration
@using System.Security.Claims
@model List<EFConfigurationValue>
@{
HtmlTitle = "网站配置";
var start = 0;
var entityName = "EFConfigurationValue";
var hasPermissions = (User.Identity as ClaimsIdentity).Claims.Any(o => o.Value.EndsWith($"-{entityName}"));
}
<form action="" method="post" class="form-horizontal">
@if (hasPermissions)
{
<div class="card">
<div class="card-header">
网站配置
</div>
<div class="card-body">
<div class="pull-left">
@if (User.IsInRole($"Add-{entityName}"))
{
<a class="btn btn-primary" href="/Admin/Configuration/Add">
新建
</a>
}
@if (User.IsInRole($"Edit-{entityName}"))
{
<a class="btn btn-primary" href="/Admin/Configuration/Edit">
移除
</a>
}
@if (User.IsInRole($"Edit-{entityName}"))
{
<a class="btn btn-primary" href="/Admin/Configuration/Edit">
还原
</a>
}
@if (User.IsInRole($"Delete-{entityName}"))
{
<a class="btn btn-danger" href="/Admin/Configuration/Edit">删除</a>
}
</div>
</div>
</div>
}
<div class="card">
<div class="card-body">
<table class="table table-striped projects">
<tr>
<th><input type="checkbox" class="select_all" /></th>
<th>行号</th>
<th>键</th>
<th>值</th>
<th>类型</th>
@if (User.IsInRole($"Edit-{entityName}"))
{
<th>编辑</th>
}
</tr>
@foreach (var item in Model)
{
<tr>
<td>
<input type="checkbox" name="list[]" value="@item.Id" />
</td>
<td>@(++start)</td>
<td>@item.Id</td>
<td>@Html.DisplayFor(o => item.Value, item.Type.ToString())</td>
<td>@item.Type.GetDisplayName()</td>
@if (User.IsInRole($"Edit-{entityName}"))
{
<td>
<a class="btn btn-info btn-sm" href="@Url.Action("Edit",new { id=item.Id})">编辑</a>
</td>
}
</tr>
}
</table>
</div>
</div>
</form>