add access level
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edituser";
|
||||
var allRoles = "addNews ,newsManagement, userManagment, tag&catManagment".Split(',');
|
||||
var Roles = Model.role.Split(',');
|
||||
}
|
||||
|
||||
<h2>Edituser</h2>
|
||||
@ -9,7 +11,7 @@
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@ -28,10 +30,17 @@
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.role, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<select name="role" class="form-control">
|
||||
<option value="0">User</option>
|
||||
<option value="2">Admin</option>
|
||||
</select>
|
||||
|
||||
@foreach (var r in Roles) { @r}
|
||||
@for (int i = 0; i < allRoles.Length; i++)
|
||||
{
|
||||
var r = allRoles[i];
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" value="@r" name="roles" id="flexCheckDefault_@i" @(Roles.Contains(r) ? "checked" : "")>
|
||||
<label class="form-check-label" for="flexCheckDefault_@i">@r</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
@Html.ValidationMessageFor(model => model.role, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user