PhoneToolMX/PhoneToolMX/Views/Phone/_Form.cshtml

43 lines
1.9 KiB
Plaintext

@model PhoneToolMX.Models.ViewModels.PhoneVM
<!--suppress HtmlDeprecatedAttribute -->
<p>Fill out the fields below, then click "Submit" to @ViewData["Action"] the phone.</p>
@using (Html.BeginForm(FormMethod.Post)) {
<table cellpadding="2" cellspacing="2" border="0" width="100%">
@if (Model != null) {
@Html.HiddenFor(m => m.Id)
}
<tr>
<th>@Html.LabelFor(m => m.MacAddress, "MAC Address:")</th>
<td>@Html.TextBoxFor(m => m.MacAddress)@Html.ValidationMessageFor(m => m.MacAddress)</td>
</tr>
<tr>
<th>@Html.LabelFor(m => m.FriendlyName, "Phone Name:")</th>
<td>@Html.TextBoxFor(m => m.FriendlyName)@Html.ValidationMessageFor(m => m.FriendlyName)</td>
</tr>
<tr>
<th>@Html.LabelFor(m => m.Model, "Phone Model:")</th>
<td>@Html.DropDownListFor(m => m.Model, new SelectList(ViewBag.ModelNumbers, "Id", "ModelName", ViewBag.CurrentModel))@Html.ValidationMessageFor(m => m.Model)</td>
</tr>
<tr>
<th>@Html.LabelFor(m => m.Extensions, "Extensions:")</th>
<td>@Html.ListBoxFor(m => m.Extensions, new MultiSelectList(ViewBag.MyExtensions, "Id", "ListViewName", ViewBag.SelectedExtensions))
</tr>
<tr>
<th>@Html.LabelFor(m => m.PrimaryExtension, "Primary Extension:")</th>
<td>@if (ViewBag.SelectedExtensions == null || ((ICollection<Extension>)ViewBag.SelectedExtensions).Count == 0) {
@Html.DropDownListFor(m => m.PrimaryExtension, new List<SelectListItem>(), "-- No Extensions Selected --", new { @disabled=true })
} else {
@Html.DropDownListFor(m => m.PrimaryExtension, new SelectList(ViewBag.SelectedExtensions, "Id", "ListViewName", ViewBag.PrimaryExtension), "None")
}</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="reset" value="Reset" />
<input type="submit" value="Submit" />
</td>
</tr>
</table>
}