Min lösning på övningen

This commit is contained in:
2019-01-17 23:11:33 +01:00
parent b6bf2776a8
commit cd91acdf53
12 changed files with 189 additions and 7 deletions

View File

@ -0,0 +1,10 @@
@model Vidly.Models.Customer
@{
ViewBag.Title = "Customer";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Customer</h2>
<h1>@Model.Name - @Model.Id</h1>

View File

@ -0,0 +1,23 @@
@model Vidly.ViewModels.CustomersViewModel
@{
ViewBag.Title = "Customers";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Customers</h2>
@if (Model.Customers.Count == 0)
{
<text>No one has rented this movie before.</text>
}
else
{
<ul>
@foreach (var customer in Model.Customers)
{
@*<li>@customer.Name</li>*@
<li>@Html.ActionLink(@customer.Name, "Details", "Customers", new { id = @customer.Id },null)</li>
}
</ul>
}

View File

@ -0,0 +1,11 @@

@{
ViewBag.Title = "Vidly";
}
<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>

View File

@ -0,0 +1,23 @@
@model Vidly.ViewModels.MoviesViewModel
@{
ViewBag.Title = "Movies";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Movies</h2>
@if (Model.Movies.Count == 0)
{
<text>No one has rented this movie before.</text>
}
else
{
<ul>
@foreach (var movie in Model.Movies)
{
<li>@movie.Name</li>
@*<li>@Html.ActionLink(@customer.Name, "Details", "Customers", new { id = @customer.Id }, null)</li>*@
}
</ul>
}

View File

@ -4,13 +4,13 @@
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
@Html.ActionLink("My Web Portal", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
@Html.ActionLink("Vidly", "Index", "Customers", new { area = "" }, new { @class = "navbar-brand" })
<div class="navbar-collapse collapse" id="navbarSupportedContent">
<ul class="nav navbar-nav mr-auto">
<li class="nav-item">@Html.ActionLink("Home", "Index", "Home", null, new { @class = "nav-link" })</li>
<li class="nav-item">@Html.ActionLink("About", "About", "Home", null, new { @class = "nav-link" })</li>
<li class="nav-item">@Html.ActionLink("Contact", "Contact", "Home", null, new { @class = "nav-link" })</li>
<li class="nav-item">@Html.ActionLink("Customers", "Customers", "Customers", null, new { @class = "nav-link" })</li>
<li class="nav-item">@Html.ActionLink("Movies", "Movies", "Movies", null, new { @class = "nav-link" })</li>
@*<li class="nav-item">@Html.ActionLink("Contact", "Contact", "Home", null, new { @class = "nav-link" })</li>*@
</ul>
@Html.Partial("_LoginPartial")
</div>