@using ACG6MvcAdHcApi.Domain; @model ACG6MvcAdHcApi.ViewModels.ProductViewModel <form asp-controller="@Model.ViewControllerName" asp-action="@Model.ViewActionName" asp-route-returnUrl="@Model.ViewReturnUrl" method="post"> <div> <fieldset> <legend></legend> <table> @if (Model.Operation == CrudOperation.Update) { <tr> <td class="editor-label"><label asp-for="Product.ProductID"></label>:</td> <td></td> <td class="editor-field"><input asp-for="Product.ProductID" readonly="readonly" /></td> <td></td> </tr> } <tr> <td class="editor-label"><label asp-for="Product.ProductName"></label>:</td> <td><span style="color: red;">*</span></td> <td class="editor-field"><input asp-for="Product.ProductName" /></td> <td class="editor-field"><span asp-validation-for="Product.ProductName"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.SupplierID"></label>:</td> <td></td> <td class="editor-field"> @if (Model.SupplierDropDownListData != null) { <select id="supplierID" asp-for="Product.SupplierID" asp-items="@(new SelectList(Model.SupplierDropDownListData, "SupplierID", "CompanyName"))"><option value="">Select One</option></select> } else { <select id="supplierID"><option value="">Select One</option></select> } </td> <td class="editor-field"><span asp-validation-for="Product.SupplierID"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.CategoryID"></label>:</td> <td></td> <td class="editor-field"> @if (Model.CategoryDropDownListData != null) { <select id="categoryID" asp-for="Product.CategoryID" asp-items="@(new SelectList(Model.CategoryDropDownListData, "CategoryID", "CategoryName"))"><option value="">Select One</option></select> } else { <select id="categoryID"><option value="">Select One</option></select> } </td> <td class="editor-field"><span asp-validation-for="Product.CategoryID"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.QuantityPerUnit"></label>:</td> <td></td> <td class="editor-field"><input asp-for="Product.QuantityPerUnit" /></td> <td class="editor-field"><span asp-validation-for="Product.QuantityPerUnit"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.UnitPrice"></label>:</td> <td></td> <td class="editor-field"><input asp-for="Product.UnitPrice" /></td> <td class="editor-field"><span asp-validation-for="Product.UnitPrice"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.UnitsInStockHidden"></label>:</td> <td></td> <td class="editor-field"><input asp-for="Product.UnitsInStockHidden" /></td> <td class="editor-field"><span asp-validation-for="Product.UnitsInStockHidden"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.UnitsOnOrderHidden"></label>:</td> <td></td> <td class="editor-field"><input asp-for="Product.UnitsOnOrderHidden" /></td> <td class="editor-field"><span asp-validation-for="Product.UnitsOnOrderHidden"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.ReorderLevelHidden"></label>:</td> <td></td> <td class="editor-field"><input asp-for="Product.ReorderLevelHidden" /></td> <td class="editor-field"><span asp-validation-for="Product.ReorderLevelHidden"></span></td> </tr> <tr> <td class="editor-label"><label asp-for="Product.Discontinued"></label>:</td> <td><span style="color: red;">*</span></td> <td class="editor-field"><input asp-for="Product.Discontinued" type="checkbox" /></td> <td class="editor-field"><span asp-validation-for="Product.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" /> } @if(Model.ViewReturnUrl != null) { <input type="button" value ="Cancel" onclick="window.location='@Model.ViewReturnUrl'; return false;" class="button-100" /> } else { <input type="button" value="Cancel" onclick="window.location='@Url.Action("Index", "Home")'; return false;" class="button-100" /> } </td> </tr> </table> </fieldset> </div> </form>