Created
November 4, 2021 16:44
-
-
Save bpesquet/7a7680aa5dcd1c2fbac6556c7f1dcb40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model MvcUniversity.Models.Instructor | |
@{ | |
ViewData["Title"] = "Edit"; | |
} | |
<h1>Edit</h1> | |
<h4>Instructor</h4> | |
<hr /> | |
<form asp-action="Edit"> | |
<div class="row"> | |
<div class="col-md-4"> | |
<div asp-validation-summary="ModelOnly" class="text-danger"></div> | |
<input type="hidden" asp-for="Id" /> | |
<div class="form-group"> | |
<label asp-for="LastName" class="control-label"></label> | |
<input asp-for="LastName" class="form-control" /> | |
<span asp-validation-for="LastName" class="text-danger"></span> | |
</div> | |
<div class="form-group"> | |
<label asp-for="FirstName" class="control-label"></label> | |
<input asp-for="FirstName" class="form-control" /> | |
<span asp-validation-for="FirstName" class="text-danger"></span> | |
</div> | |
<div class="form-group"> | |
<label asp-for="HireDate" class="control-label"></label> | |
<input asp-for="HireDate" class="form-control" /> | |
<span asp-validation-for="HireDate" class="text-danger"></span> | |
</div> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-md-10"> | |
<div class="form-group"> | |
<table> | |
<tr> | |
@{ | |
int cnt = 0; | |
List<MvcUniversity.Models.AssignedCourseViewModel> courses = ViewBag.Courses; | |
foreach (var course in courses) | |
{ | |
if (cnt++ % 3 == 0) | |
{ | |
@:</tr><tr> | |
} | |
// HTML hack to add some space betwen cells | |
@:<td style="padding: 2px 10px;"> | |
<input type="checkbox" | |
name="selectedCourses" | |
value="@course.Id" | |
@(Html.Raw(course.Assigned ? "checked=\"checked\"" : "")) /> | |
@course.Id @: @course.Title | |
@:</td> | |
} | |
@:</tr> | |
} | |
</table> | |
</div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<input type="submit" value="Save" class="btn btn-primary" /> | |
</div> | |
</form> | |
<div> | |
<a asp-action="Index">Back to List</a> | |
</div> | |
@section Scripts { | |
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment