Lite upprensning bland kontroller och views, cutomers kan läggas till och uppdateras
This commit is contained in:
40
Vidly/Views/Customers/CustomerForm.cshtml
Normal file
40
Vidly/Views/Customers/CustomerForm.cshtml
Normal file
@ -0,0 +1,40 @@
|
||||
@model Vidly.ViewModels.CustomerFormViewModel
|
||||
@{
|
||||
/**/
|
||||
|
||||
ViewBag.Title = "New";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
@if (Model.Customer.Id==null|| Model.Customer.Id == 0)
|
||||
{
|
||||
<h2>New Customer</h2>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h2>Edit Customer</h2>
|
||||
}
|
||||
|
||||
@using (@Html.BeginForm("Save", "Customers"))
|
||||
{
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.Customer.Name)
|
||||
@Html.TextBoxFor(m => m.Customer.Name, new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.Customer.BirthDate)
|
||||
@Html.TextBoxFor(m => m.Customer.BirthDate, "{0:d MMM yyyy}", new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@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" })
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
@Html.CheckBoxFor(m => m.Customer.IsSubscribedToNewsLetter) Subscribed to Newsletter ?
|
||||
</label>
|
||||
</div>
|
||||
@Html.HiddenFor(m => m.Customer.Id)
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user