@model RoleModel
@* Generated from Custom Template. *@
@* Model namespace using directive should be added to _ViewImports.cshtml. *@
@{
var containerDivClass = "container";
}
@{
ViewData["Title"] = "Role Details";
}
<div class="@containerDivClass">
<h3>@ViewData["Title"]</h3>
<hr />
</div>
@if (Model is not null)
{
<div class="@containerDivClass">
@if (TempData["Message"] is not null) @* displaying the TempData["Message"] value if it is not null *@
{
<p class="text-danger">
@TempData["Message"]
</p>
}
<div class="row mb-3">
<div class="col-2 fw-bold">
@Html.DisplayNameFor(model => model.Name)
</div>
<div class="col-10">
@Html.DisplayFor(model => model.Name)
</div>
</div>
@* Users: property for formatted or relational data in the model *@
@* Displaying the one to many user relational data of the role: *@
<div class="row mb-3">
<div class="col-2 fw-bold">
@Html.DisplayNameFor(model => model.Users)
</div>
<div class="col-10">
@Html.Raw(Model.Users) @* Raw HTML Helper Method is used to format the output when model's property value contains HTML tags *@
</div>
</div>
@* Can be uncommented and used for many to many relationships. {Entity} may be replaced with the related entiy name in the controller and views. *@
@*
<div class="row mb-3">
<div class="col-2 fw-bold">
<b>@Html.DisplayNameFor(model => model.{Entity}s)</b>
</div>
<div class="col-10">
@Html.Raw(Model.{Entity}s)
</div>
</div>
*@
<hr />
<a asp-action="Edit" asp-route-id="@Model.Record.Id">Edit</a> |
<a asp-action="Delete" asp-route-id="@Model.Record.Id">Delete</a> |
<a asp-action="Index">Back to List</a>
</div>
}