@model IEnumerable<BookStore_DataAccess.model.Book>

@{
    ViewBag.Title = "Index_Admin";
}

<h2>Index_Admin</h2>

<p>
    @Html.ActionLink("Create New", "CreateBook")

    @using (Html.BeginForm())
    {
    <p>
        Book Name: @Html.TextBox("SearchString") <br />
        <input type="submit" value="Search" />
    </p>
    }

    </p>
    <table class="table">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Publisher.PublisherName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BookTitle)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BookPrice)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Publisher.PublisherName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BookTitle)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BookPrice)
                </td>
                <td>
                    @Html.ActionLink("Edit", "EditBook", new { id = item.BookId }) |
                    @Html.ActionLink("Details", "Detail_Admin", new { id = item.BookId }) |
                    @Html.ActionLink("Delete", "DeleteBook", new { id = item.BookId })
                </td>
            </tr>
        }

    </table>
