Clear        


                
                    @model UserModel

@* Generated from Custom Template. *@
@* Model namespace using directive should be added to _ViewImports.cshtml. *@

@{
    var containerDivClass = "container";
    var dateTimePickerClass = "datetimepicker";
}
@{
    ViewData["Title"] = "User Edit";
}

<div class="@containerDivClass">
    <h3>@ViewData["Title"]</h3>
    <hr />
</div>

@if (Model is not null)
{
<div class="@containerDivClass">
    @if (TempData["Message"] is not null)
    {
    <p class="text-danger">
        @TempData["Message"]
    </p>
    }
    <form asp-action="Edit" autocomplete="off">
	    @Html.AntiForgeryToken()
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <div class="row mb-3">
            <label asp-for="UserName" class="col-2 col-form-label fw-bold"></label>
	        <div class="col-10">
	            <input asp-for="Record.UserName" class="form-control" />
		        <span asp-validation-for="Record.UserName" class="text-danger"></span>
	        </div>
        </div>
        <div class="row mb-3">
            <label asp-for="Password" class="col-2 col-form-label fw-bold"></label>
	        <div class="col-10">
	            <input asp-for="Record.Password" class="form-control" />
		        <span asp-validation-for="Record.Password" class="text-danger"></span>
	        </div>
        </div>
        <div class="row mb-3">
		    <label asp-for="IsActive" class="col-2 col-form-label fw-bold"></label>
		    <div class="col-10 pt-2">
			    <input class="form-check-input" asp-for="Record.IsActive" />
            </div>
        </div>
        
        @* For enums, we need to generate the HTML tags explicitly, here we will generate radio buttons: *@
        <div class="row mb-3">
            <label asp-for="Status" class="col-2 col-form-label fw-bold"></label>
			<div class="col-10">
                <div class="form-check form-check-inline">
                    <input asp-for="Record.Status" type="radio" class="form-check-input" value="@((int)Statuses.Junior)" id="junior" checked /> @* rendering the enum's value part *@
                    <label class="form-check-label" for="junior">@Statuses.Junior</label> @* rendering the enum's text part *@
                    @* HTML for attribute of a label tag is used to focus or check the HTML element that has the same id attribute value *@
                </div>
                <div class="form-check form-check-inline">
                    <input asp-for="Record.Status" type="radio" class="form-check-input" value="@((int)Statuses.Senior)" id="senior" />
                    <label class="form-check-label" for="senior">@Statuses.Senior</label>
                </div>
                <div class="form-check form-check-inline">
                    <input asp-for="Record.Status" type="radio" class="form-check-input" value="@((int)Statuses.Master)" id="master" />
                    <label class="form-check-label" for="master">@Statuses.Master</label>
                </div>
			</div>
        </div>

        <div class="row mb-3">
            <label asp-for="Role" class="col-2 col-form-label fw-bold"></label>
            <div class="col-10">
	            <select asp-for="Record.RoleId" class="form-select" asp-items="ViewBag.RoleId">
		            <option value="">-- Select --</option>
	            </select>
	            <span asp-validation-for="Record.RoleId" class="text-danger"></span>
            </div>
        </div>
        <input type="hidden" asp-for="Record.Id" />

@* 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">
            <label asp-for="{Entity}Ids" class="col-2 col-form-label fw-bold"></label>
	        <div class="col-10">
		        <select multiple asp-for="{Entity}Ids" class="form-select" asp-items="ViewBag.{Entity}Ids"></select>
		        <span asp-validation-for="{Entity}Ids" class="text-danger"></span>
	        </div>
        </div>
        *@

        <hr />
        <div class="row mb-3">
	        <div class="offset-2 col-10">
                <button type="submit" class="btn btn-primary">Save</button>
		        &nbsp;&nbsp;
                <button type="reset" class="btn btn-outline-primary">Reset</button>
		        &nbsp;&nbsp;
                <a asp-action="Delete" asp-route-id="@Model.Record.Id">Delete</a>
                &nbsp;&nbsp;
		        <a asp-action="Index">Back to List</a>
	        </div>
        </div>
    </form>
</div>
}

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}