@using UniversityContracts.ViewModels
@model List<TeacherViewModel>
@{
    ViewData["Title"] = "Преподаватели";
}

<div class="text-center">
    <h2 class="display-4">@ViewData["Title"]</h2>
</div>


<form method="post">
    <div class="row">
        <div class="col-4">Имя:</div>
        <div class="col-8">
            <input type="text" name="name" id="name" class="form-control" />
        </div>
    </div>
    <div class="row">
        <div class="col-4">Учёная степень:</div>
        <div class="col-8">
            <input type="text" name="academicDegree" id="academicDegree" class="form-control" />
        </div>
    </div>
    <div class="row">
        <div class="col-4">Должность:</div>
        <div class="col-8">
            <input type="text" name="position" id="position" class="form-control" />
        </div>
    </div>
    <div class="row">
        <div class="col-8"></div>
        <div class="col-4">
            <input type="submit" value="Create Teacher" class="btn btn-primary" />
        </div>
    </div>
</form>

<table class="table">
    <thead>
        <tr>
            <th>Id</th>
            <th>Имя</th>
            <th>Учёная степень</th>
            <th>Должность</th>
            <th>Действия</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Id)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AcademicDegree)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Position)
                </td>
                <td>
                    <div class="btn-group">
                        <a asp-controller="Home" asp-action="InfoTeacher" asp-route-id="@item.Id" class="btn btn-warning">Изменить</a>
                        <form asp-controller="Home" asp-action="DeleteTeacher" method="post">
                            <input type="hidden" name="id" value="@item.Id" />
                            <button type="submit" class="btn btn-danger">Удалить</button>
                        </form>
                    </div>
                </td>
            </tr>
        }
    </tbody>
</table>


