@model PackageVersionIndexViewModel

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

<h2>Index</h2>

<p>
    <form method="get">
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        
        <div class="form-group">
            <label asp-for="PackageId" class="control-label"></label>
            <input asp-for="PackageId" class="form-control" />
        </div>
        <div class="form-group">
            <label asp-for="Prerelease" class="control-label"></label>
            <input asp-for="Prerelease" class="form-control" />
        </div>
        <div class="form-group">
            <input type="submit" value="Find" class="btn btn-default" />
        </div>
    </form>
</p>

<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Versions[0].PackageId)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Versions[0].FullString)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Versions[0].IsPrerelease)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
@foreach (var item in Model.Versions) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.PackageId)
                <a href="@Constants.ApiVersionPrefix@item.NugetLink">
                nuget
                </a>
                
                <a href="@Constants.ApiVersionPrefix@item.NuspecLink">
                nuspec
                </a>
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.FullString)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.IsPrerelease)
            </td>
            <td>
                @Html.ActionLink("Details", "Details", new { pkgid = item.PackageId, version = item.FullString, pkgtype = item.Type }) |
                @Html.ActionLink("Delete", "Delete", new { pkgid = item.PackageId, version = item.FullString, pkgtype = item.Type })
            </td>
        </tr>
}
    </tbody>
</table>
