Lite upprensning bland kontroller och views, cutomers kan läggas till och uppdateras

This commit is contained in:
2019-01-22 22:21:05 +01:00
parent 00f1700aa6
commit 11b51493fe
16 changed files with 221 additions and 81 deletions

View File

@ -1,11 +1,37 @@

@model Vidly.ViewModels.CustomersViewModel
@{
ViewBag.Title = "Vidly";
ViewBag.Title = "Customers";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="jumbotron">
<h1>V i d l y</h1>
<p class="lead">Vidly is a great video rental system built in MVC5 with entity framework, Razorviews and Javascript.</p>
@*<p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>*@
</div>
<h2>Customers</h2>
@*<button type="submit" class="btn btn-primary" onclick="">New Customer</button>*@
@Html.ActionLink("New Customer", "New", "Customers", null, new { @class = "btn btn-primary" })
@if (Model.Customers.Count == 0)
{
<text>No one has rented this movie before.</text>
}
else
{
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Customer</th>
<th>Membership Type</th>
</tr>
</thead>
<tbody>
@foreach (var customer in Model.Customers)
{
<tr>
<td>@Html.ActionLink(@customer.Name, "Edit", "Customers", new { id = @customer.Id }, null)</td>
<td>@customer.MembershipType.Name</td>
</tr>
}
</tbody>
</table>
}