@using ComputerHardwareStoreContracts.ViewModels
@model List<CommentViewModel>
@{
	ViewData["Title"] = "Comments";
}
<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 class="text-decoration-none me-3 text-black h5" asp-action="CommentCreate">Создать комментарий</a>
			<a class="text-decoration-none me-3 text-black h5" asp-action="CommentUpdate">изменить коммментарий</a>
			<a class="text-decoration-none text-black h5" asp-action="CommentDelete">Удалить комментарий</a>
		</p>

		<table class="table">
			<thead>
				<tr>
					<th>
						Номер
					</th>
					<th>
						Заголовок
					</th>
					<th>
						Текст
					</th>
				</tr>
			</thead>
			<tbody>
				@foreach (var comment in Model)
				{
					<tr>
						<td>
							@Html.DisplayFor(modelItem => comment.Id)
						</td>
						<td>
							@Html.DisplayFor(modelItem => comment.Text)
						</td>
					</tr>
				}
			</tbody>
		</table>
	}
</div>