2023-05-17 10:48:52 +04:00

72 lines
1.4 KiB
Plaintext

@using TaskTrackerContracts.ViewModels
@model List<EmployeeViewModel>
@{
ViewData["Title"] = "Employees";
}
<div class="text-center">
<h1 class="display-4">Сотрудники</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<p>
<a asp-controller="Employee" asp-action="CreateEmployee">Добавить сотрудника</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Имя
</th>
<th>
Должность
</th>
<th>
E-mail
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td id="id">
@Html.DisplayFor(modelItem =>
item.Name)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.JobTitle)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Email)
</td>
<td>
<form action="/Employee/DeleteEmployee" method="post">
<input type="hidden" name="id" value="@item.Id" />
<button type="submit" class="btn btn-danger">Удалить</button>
</form>
</td>
<td>
<form action="/Employee/UpdateEmployee">
<input type="hidden" name="id" value="@item.Id" />
<button type="submit" class="btn btn-danger">Изменить</button>
</form>
</td>
</tr>
}
</tbody>
</table>
}
</div>