mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
39 lines
929 B
Plaintext
39 lines
929 B
Plaintext
@model Northwind.Mvc.Models.HomeModelBindingViewModel
|
|
@{
|
|
ViewData["Title"] = "Model Binding Demo";
|
|
}
|
|
<h1>@ViewData["Title"]</h1>
|
|
<div>
|
|
Enter values for your thing in the following form:
|
|
</div>
|
|
<form method="POST" action="/home/modelbinding?id=3">
|
|
<input name="id" value="1" />
|
|
<input name="color" value="Red" />
|
|
<input name="email" value="test@example.com" />
|
|
<input type="submit" />
|
|
</form>
|
|
@if (Model is not null)
|
|
{
|
|
<h2>Submitted Thing</h2>
|
|
<hr />
|
|
<div>
|
|
<dl class="dl-horizontal">
|
|
<dt>Model.Thing.Id</dt>
|
|
<dd>@Model.Thing.Id</dd>
|
|
<dt>Model.Thing.Color</dt>
|
|
<dd>@Model.Thing.Color</dd>
|
|
<dt>Model.Thing.Email</dt>
|
|
<dd>@Model.Thing.Email</dd>
|
|
</dl>
|
|
</div>
|
|
@if (Model.HasErrors)
|
|
{
|
|
<div>
|
|
@foreach (string errorMessage in Model.ValidationErrors)
|
|
{
|
|
<div class="alert alert-danger" role="alert">@errorMessage</div>
|
|
}
|
|
</div>
|
|
}
|
|
}
|