@using ComputerShopContracts.ViewModels

@model List<ComponentViewModel>

@{
	ViewData["Title"] = "Component";
}

<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-action="CreateComponent">Создать комплектующее</a>
		</p>
		<p>
			<a asp-action="EditComponent">Изменить комплектующее</a>
		</p>
		<p>
			<a asp-action="DeleteComponent">Удалить комплектующее</a>
		</p>
		<table class="table">
			<thead>
				<tr>
					<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.ComponentName)
						</td>
						<td>
							@Html.DisplayFor(modelItem => item.Cost)
						</td>
					</tr>
				}
			</tbody>
		</table>
	}
</div>