@using ComputerHardwareStoreContracts.ViewModels
@model List<PurchaseViewModel>
@{
	ViewData["Title"] = "Purchases";
}
<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="PurchaseCreate">Создать покупку</a>
			<a class="text-decoration-none me-3 text-black h5" asp-action="PurchaseUpdate">Изменить покупку</a>
			<a class="text-decoration-none me-3 text-black h5" asp-action="AddBuildTo">Добавить сборку в покупку</a>
			<a class="text-decoration-none text-black h5" asp-action="PurchaseDelete">Удалить покупку</a>
		</p>

		<table class="table">
			<thead>
				<tr>
					<th>
						Номер
					</th>
					<th>
						Дата
					</th>
					<th>
						Сумма
                    </th>
                    <th>
                        Адрес
                    </th>
				</tr>
			</thead>
			<tbody>
				@foreach (var puchase in Model)
				{
					<tr>
						<td>
							@Html.DisplayFor(modelItem => puchase.Id)
						</td>
						<td>
							@Html.DisplayFor(modelItem => puchase.DateCreate)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => puchase.Sum)
                        </td>
						<td>
							@Html.DisplayFor(modelItem => puchase.DateImplement)
						</td>
					</tr>
				}
			</tbody>
		</table>
	}
</div>