@using NorthwindAPI.Domain;
@model NorthwindAPI.ViewModels.ProductsViewModel
 
<form asp-controller="@Model.ViewControllerName" asp-action="@Model.ViewActionName" method="post">
 
    <div>
        <fieldset>
            <legend></legend>
            <table>
                @if (Model.Operation == CrudOperation.Update)
                {
                    <tr>
                        <td class="editor-label"><label asp-for="ProductsModel.ProductID"></label>:</td>
                        <td></td>
                        <td class="editor-field"><input asp-for="ProductsModel.ProductID" readonly="readonly" /></td>
                        <td></td>
                    </tr>
                }
 
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.ProductName"></label>:</td>
                    <td><span style="colorred;">*</span></td>
                    <td class="editor-field"><input asp-for="ProductsModel.ProductName" /></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.ProductName"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.SupplierID"></label>:</td>
                    <td></td>
                    <td class="editor-field"><select id="supplierID" asp-for="ProductsModel.SupplierID" asp-items="@(new SelectList(Model.SuppliersDropDownListData, "SupplierID""CompanyName"))"><option value="">Select One</option></select></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.SupplierID"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.CategoryID"></label>:</td>
                    <td></td>
                    <td class="editor-field"><select id="categoryID" asp-for="ProductsModel.CategoryID" asp-items="@(new SelectList(Model.CategoriesDropDownListData, "CategoryID""CategoryName"))"><option value="">Select One</option></select></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.CategoryID"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.QuantityPerUnit"></label>:</td>
                    <td></td>
                    <td class="editor-field"><input asp-for="ProductsModel.QuantityPerUnit" /></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.QuantityPerUnit"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.UnitPrice"></label>:</td>
                    <td></td>
                    <td class="editor-field"><input asp-for="ProductsModel.UnitPrice" /></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.UnitPrice"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.UnitsInStockHidden"></label>:</td>
                    <td></td>
                    <td class="editor-field"><input asp-for="ProductsModel.UnitsInStockHidden" /></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.UnitsInStockHidden"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.UnitsOnOrderHidden"></label>:</td>
                    <td></td>
                    <td class="editor-field"><input asp-for="ProductsModel.UnitsOnOrderHidden" /></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.UnitsOnOrderHidden"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.ReorderLevelHidden"></label>:</td>
                    <td></td>
                    <td class="editor-field"><input asp-for="ProductsModel.ReorderLevelHidden" /></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.ReorderLevelHidden"></span></td>
                </tr>
                <tr>
                    <td class="editor-label"><label asp-for="ProductsModel.Discontinued"></label>:</td>
                    <td><span style="colorred;">*</span></td>
                    <td class="editor-field"><input asp-for="ProductsModel.Discontinued" type="checkbox" /></td>
                    <td class="editor-field"><span asp-validation-for="ProductsModel.Discontinued"></span></td>
                </tr>
                <tr>
                    <td colspan="2"></td>
                    <td colspan="2">
                        <br />
                        @if (Model.Operation == CrudOperation.Add)
                        {
                            <input type="submit" value="Add" class="button-150" />
                        }
                        else
                        {
                            <input type="submit" value="Update" class="button-150" />
                        }
 
                        <input type="button" value="Cancel" onclick="window.location = '@Model.ViewReturnUrl'return false;" class="button-100" />
                    </td>
                </tr>
            </table>
        </fieldset>
    </div>
</form>