59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
@model WebApplication1.Models.user
|
|
|
|
@{
|
|
ViewBag.Title = "Edituser";
|
|
var allRoles = "addNews ,newsManagement, userManagment, tag&catManagment".Split(',');
|
|
var Roles = Model.role.Split(',');
|
|
}
|
|
|
|
<h2>Edituser</h2>
|
|
|
|
@using (Html.BeginForm())
|
|
{
|
|
@Html.AntiForgeryToken()
|
|
|
|
<div class="form-horizontal">
|
|
<h4>user</h4>
|
|
<hr />
|
|
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
|
@Html.HiddenFor(model => model.ID)
|
|
|
|
|
|
<div class="form-group">
|
|
@Html.LabelFor(model => model.displayname, htmlAttributes: new { @class = "control-label col-md-2" })
|
|
<div class="col-md-10">
|
|
@Html.EditorFor(model => model.displayname, new { htmlAttributes = new { @class = "form-control" } })
|
|
@Html.ValidationMessageFor(model => model.displayname, "", new { @class = "text-danger" })
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
@Html.LabelFor(model => model.role, htmlAttributes: new { @class = "control-label col-md-2" })
|
|
<div class="col-md-10">
|
|
|
|
@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>
|
|
|
|
<div class="form-group">
|
|
<div class="col-md-offset-2 col-md-10">
|
|
<input type="submit" value="Save" class="btn btn-default" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
<div>
|
|
@Html.ActionLink("Back to List", "Index")
|
|
</div>
|