@model Vidly.ViewModels.CustomerFormViewModel @{ /**/ ViewBag.Title = "New"; Layout = "~/Views/Shared/_Layout.cshtml"; } @if (Model.Customer.Id == null || Model.Customer.Id == 0) {

New Customer

} else {

Edit Customer

} @using (@Html.BeginForm("Save", "Customers")) { @Html.ValidationSummary(true, "Var snäll och åtgärda felen.")
@Html.LabelFor(m => m.Customer.Name) @Html.TextBoxFor(m => m.Customer.Name, new { @class = "form-control" }) @Html.ValidationMessageFor(m => m.Customer.Name)
@Html.LabelFor(m => m.Customer.MembershipTypeId) @Html.DropDownListFor(m => m.Customer.MembershipTypeId, new SelectList(Model.MembershipTypes, "Id", "Name"), "Select membership Type", new { @class = "form-control" }) @Html.ValidationMessageFor(m => m.Customer.MembershipTypeId)
@Html.LabelFor(m => m.Customer.BirthDate) @Html.TextBoxFor(m => m.Customer.BirthDate, "{0:d MMM yyyy}", new { @class = "form-control" }) @Html.ValidationMessageFor(m => m.Customer.BirthDate)
@Html.HiddenFor(m => m.Customer.Id) @Html.AntiForgeryToken(); } @section scripts { @Scripts.Render("~/bundles/jqueryval") }