在工作中做了这么一个东西。
HTML端:
@using Test.fh.Project.Storefront.ViewModels @using Test.fh.Project.Storefront.Services @model ProductViewModelCategories@*@Url.Action("Update", "Product");*@ @foreach (var item in ViewBag.Options) { if (item.Key["type"] == "file") { } }@MvcHtmlString.Create(@Model.product_name)
@using (Html.BeginForm("index", "Product")) { @Html.ValidationSummary(excludePropertyErrors: true)@if (Model.manufacturer != null || Model.manufacturer != "") { Brand: @Model.manufacturer
} Product Code: @Model.model
Reward Points: @Model.reward
Availability: @Model.stock_statusPrice: @if (Model.special == null || Model.special == "") { @Currency.format(Model.price, null, null, true) } else { @Currency.format(Model.price, null, null, true) @Currency.format(Model.special, null, null, true) }@if (ViewBag.Options != null) { }
Ex Tax: @if (Model.special != null && Model.special != "") { @Currency.format(Model.special, null, null, true) } else { @Currency.format(Model.price, null, null, true) }
Price in reward points: @Model.points
@foreach (var item in ViewBag.Discounts) { @string.Format("({0} or more {1})", @item["quantity"], @Currency.format(item["price"].ToString(), null, null, true));
}Qty: @Html.TextBoxFor(model => model.minimum, new { maxlength = 2, name = "quantity" }) @Html.HiddenFor(model => model.product_id)   Add to Cart- OR -@if (int.Parse(Model.minimum) > 1) {This product has a minimum quantity of @Model.minimum}@@##@@ @Model.reviews reviews | Write a reviewDescription @if (ViewBag.attribute_groups != null) { Specification } Reviews @if (ViewBag.relate_products != null) { Related Products (@ViewBag.relate_products.Count) }@Html.Raw(@Model.description)if (ViewBag.attribute_groups != null) {}@foreach (var item in ViewBag.attribute_groups) {
@foreach (var item_att in item.Value) { @item.Key["name"] } } @item_att["name"] @item_att["text"] if (ViewBag.relate_products != null) { } if (ViewBag.tags != null) { } }










