@using Library.Models;
@{
    string title = ViewBag.Title;
    string caption = ViewBag.Caption;
    string NameError = ViewBag?.NameError;
    string PublisherError = ViewBag?.PublisherError;
    string AuthorsError = ViewBag?.AuthorsError;
    string PublDateError = ViewBag?.PublDateError;
    string PageCountError = ViewBag?.PageCountError;
    string IsbnError = ViewBag?.IsbnError;
    BookModel book = ViewBag?.Book ?? null;
    IEnumerable<PublisherModel> publishers = ViewBag?.Publishers;
    IEnumerable<AuthorModel> authors = ViewBag?.Authors;
}

<form id="CreateBookForm" style="align-self:center;" method="post">
<div class="fields book-fields">
    <h2>@caption</h2>
    @CreateForm.FormForBook(book, publishers, authors, NameError, PublisherError, AuthorsError, PublDateError, PageCountError, IsbnError)
                
    <button type="submit">@((book != null && book?.Id != null) ? "Редактировать" : "Создать")</button>
</div>
</form>
