CourseWork/University/UniversityClientAppWorker/Views/Home/Students.cshtml

79 lines
2.5 KiB
Plaintext
Raw Normal View History

@using UniversityContracts.ViewModels
@model List<StudentViewModel>
@{
2024-05-27 22:35:38 +04:00
ViewData["Title"] = "Управление студентами";
}
<div class="text-center">
<h2 class="display-4">@ViewData["Title"]</h2>
</div>
2024-05-27 22:35:38 +04:00
<form asp-action="CreateStudent" method="post">
<div class="row">
2024-05-27 22:35:38 +04:00
<div class="col-4">ФИО:</div>
<div class="col-8">
<input type="text" name="name" id="name" class="form-control" />
</div>
</div>
<div class="row">
2024-05-27 22:35:38 +04:00
<div class="col-4">План обучения:</div>
<div class="col-8">
2024-05-27 22:35:38 +04:00
<select name="planOfStudy" id="planOfStudy" class="form-control" asp-items="@(new SelectList(ViewBag.PlanOfStudys, "Id", "Profile"))"></select>
</div>
</div>
<div class="row">
2024-05-27 22:35:38 +04:00
<div class="col-4">Номер телефона:</div>
<div class="col-8">
<textarea id="phoneNumber" name="phoneNumber" class="form-control"></textarea>
</div>
</div>
<div class="row">
<div class="col-8"></div>
2024-05-27 22:35:38 +04:00
<div class="col-4 mt-2">
<input type="submit" value="Добавить студента" class="btn btn-primary" />
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th>Id</th>
2024-05-27 22:35:38 +04:00
<th>ФИО</th>
<th>План обучения</th>
<th>Номер телефона</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
@foreach (var student in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => student.Id)
</td>
<td>
@Html.DisplayFor(modelItem => student.Name)
</td>
<td>
@Html.DisplayFor(modelItem => student.PlanOfStudyId)
</td>
<td>
@Html.DisplayFor(modelItem => student.PhoneNumber)
</td>
<td>
2024-05-27 22:35:38 +04:00
<div class="btn-group">
<a asp-controller="Home" asp-action="" asp-route-id="@student.Id" class="btn btn-warning">Изменить</a>
<form asp-controller="Home" asp-action="DeletePlanOfStudy" method="post">
<input type="hidden" name="id" value="@student.Id" />
<button type="submit" class="btn btn-danger">Удалить</button>
</form>
</div>
</td>
</tr>
}
</tbody>
</table>