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

<h1>Create</h1>
@{
    if (ViewBag.Success != null)
    {
        <p class="alert-success">@(ViewBag.Success)</p>
    }
    else if (ViewBag.Exception != null)
    {
        <p class="alert-danger">Errors detected in your form submission, please correct the following and resubmit:</p>
        <ul class="alert-danger">
            @foreach (Exception e in ViewBag.Exception.SubExceptions)
            {
                <li>@(e.Message)</li>
            }
        </ul>
    }
}

<form action="/Book/Create" method="get">
    <div>
        <label for="title">Title</label>
        <input type="text" id="title" name="title" value="@(ViewBag.BookTitle)" />
    </div>
    <div>
        @* value="@(ViewBag.Author) *@
        <label for="authorID">Author</label>
        <select id="authorID" name="authorID">
            @foreach (Author author in ViewBag.Authors)
            {
                <option value="@(author.ID)">@(author.Name)</option>
            }

        </select>
    </div>
    <div>
        <label for="publicationDate">Publication Date</label>
        <input type="date" id="publicationDate" name="publicationDate" value="@(ViewBag.PublicationDate)" />
    </div>
    <!--Remove the “Checked Out Date” form input.-->
    <button type="submit">Go!</button>
</form>