@model IEnumerable<CodingWiki_Model.Models.Category>

<br />
<br />
<div class="border p-4 bg-white">
    <div class="row">
        <div class="col-9">
            <h2 class="text-info"> Category List</h2>
        </div>

        <div class="col-3 text-right">
            <a asp-action="Upsert" class="btn btn-info form-control"> Create New </a>
        </div>
    </div>
    <div class="row">
        <div class="col-3 text-right">
            <a asp-action="CreateMultiple2" class="btn btn-success form-control"> Add 2 </a>
        </div>
        <div class="col-3 text-right">
            <a asp-action="CreateMultiple5" class="btn btn-success form-control"> Add 5 </a>
        </div>
        <div class="col-3 text-right">
            <a asp-action="RemoveMultiple2" class="btn btn-danger form-control"> Remove 2 </a>
        </div>
        <div class="col-3 text-right">
            <a asp-action="RemoveMultiple5" class="btn btn-danger form-control"> Remove 5 </a>
        </div>
    </div>
    <br />
    <div>
        @if (Model.Count() > 0)
        {
                <table class="table table-striped border">
                    <tr class="table-secondary">
                        <th>
                            Category Name
                        </th>
                        <th></th>
                    </tr>
                @foreach (var item in Model)
                {
                            <tr>
                                <td>
                            @item.CategoryName
                                </td>
                                <td>
                                    <a class="btn btn-primary text-white" asp-action="Upsert" asp-route-Id="@item.CategoryId">
                                       Edit
                                    </a>

                                    <a class="btn btn-danger text-white" asp-action="Delete" asp-route-Id="@item.CategoryId">
                                        Delete
                                    </a>
                                </td>
                            </tr>
                }
                </table>
        }
        else
        {
                <p>No category exists...</p>
        }
    </div>
</div>