PIbd-21_CourseWork_Polyclin.../Polyclinic/PolyclinicWebAppImplementer/Views/Recipe/LinkCourse.cshtml

68 lines
2.4 KiB
Plaintext
Raw Normal View History

@model RecipeLinkCourseModel
@{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.AddRecipeToCourse;
}
<h4>Привязка рецепта к курсу</h4>
<div class="row">
<form method="post" class="col">
<div class="row mb-2">
<div class="col-3 d-flex align-content-center">
<h5 class="me-2">Рецепт</h5>
<select required asp-for="@Model.RecipeId" class="me-2">
<option value="">Выберите рецепт</option>
@foreach (var item in Model.Recipes)
{
@if (item.CourseId == null)
{
<option value="@item.Id">#@item.Id @item.Comment</option>
}
}
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-3 d-flex align-content-center">
<h5 class="me-2">Курс</h5>
<select required asp-for="@Model.CourseId" class="me-2">
<option value="">Выберите курс</option>
@foreach (var item in Model.Courses)
{
<option value="@item.Id">#@item.Id @item.Comment</option>
}
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-3">
<button class="btn btn-primary" type="submit">
Привязать
</button>
</div>
</div>
</form>
<div class="col">
<h4>Привязанные рецепты</h4>
<table>
<tr>
<th>Рецепт</th>
<th>Курс</th>
<th></th>
</tr>
@foreach (var item in Model.LinkedRecipes)
{
<tr>
<td>#@item.Recipe.Id @item.Recipe.Comment</td>
<td>#@item.Course.Id @item.Course.Comment</td>
<td>
<form method="post" asp-action="UnLinkCourse" asp-route-id="@item.Recipe.Id">
<button class="btn btn-danger btm-sm" type="submit">
Отвязать
</button>
</form>
</td>
</tr>
}
</table>
</div>
</div>