9.3.2 Adding the Checkout Process; Listing 9-12 Reducing Duplication in the Checkout.cshtml File
parent
4090de140a
commit
9491c62113
|
@ -17,35 +17,16 @@
|
|||
</div>
|
||||
|
||||
<h3>Address</h3>
|
||||
|
||||
foreach (var property in ViewData.ModelMetadata.Properties)
|
||||
{
|
||||
if (property.PropertyName != "Name" && property.PropertyName != "GiftWrap")
|
||||
{
|
||||
<div class="form-group">
|
||||
<label>Line 1:</label>
|
||||
@Html.TextBoxFor(x => x.Line1, new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Line 2:</label>
|
||||
@Html.TextBoxFor(x => x.Line2, new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Line 3:</label>
|
||||
@Html.TextBoxFor(x => x.Line3, new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>City:</label>
|
||||
@Html.TextBoxFor(x => x.City, new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>State:</label>
|
||||
@Html.TextBoxFor(x => x.State, new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Zip:</label>
|
||||
@Html.TextBoxFor(x => x.Zip, new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Country:</label>
|
||||
@Html.TextBoxFor(x => x.Country, new { @class = "form-control" })
|
||||
<label>@(property.DisplayName ?? property.PropertyName)</label>
|
||||
@Html.TextBox(property.PropertyName, null, new { @class = "form-control" })
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<h3>Options</h3>
|
||||
<div class="checkbox">
|
||||
|
|
Loading…
Reference in New Issue