Exercise Files

This commit is contained in:
Jess Chadwick
2018-06-06 23:57:58 -04:00
commit 20458e435e
4436 changed files with 1359080 additions and 0 deletions

View File

@ -0,0 +1,10 @@
@{
ViewBag.Title = "Confirm Email";
}
<h2>@ViewBag.Title.</h2>
<div>
<p>
Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
</p>
</div>

View File

@ -0,0 +1,36 @@
@model HPlusSports.Models.ExternalLoginConfirmationViewModel
@{
ViewBag.Title = "Register";
}
<h2>@ViewBag.Title.</h2>
<h3>Associate your @ViewBag.LoginProvider account.</h3>
@using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<h4>Association Form</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<p class="text-info">
You've successfully authenticated with <strong>@ViewBag.LoginProvider</strong>.
Please enter a user name for this site below and click the Register button to finish
logging in.
</p>
<div class="form-group">
@Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Register" />
</div>
</div>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,8 @@
@{
ViewBag.Title = "Login Failure";
}
<hgroup>
<h2>@ViewBag.Title.</h2>
<h3 class="text-danger">Unsuccessful login with service.</h3>
</hgroup>

View File

@ -0,0 +1,29 @@
@model HPlusSports.Models.ForgotPasswordViewModel
@{
ViewBag.Title = "Forgot your password?";
}
<h2>@ViewBag.Title.</h2>
@using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<h4>Enter your email.</h4>
<hr />
@Html.ValidationSummary("", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Email Link" />
</div>
</div>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,13 @@
@{
ViewBag.Title = "Forgot Password Confirmation";
}
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
</hgroup>
<div>
<p>
Please check your email to reset your password.
</p>
</div>

View File

@ -0,0 +1,53 @@
@using HPlusSports.Models
@model LoginViewModel
@{
ViewBag.Title = "";
}
<h2>User Login</h2>
<div class="row">
<div class="col-md-8">
<section id="loginForm">
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.Password, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
@Html.CheckBoxFor(m => m.RememberMe)
@Html.LabelFor(m => m.RememberMe)
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Log in" class="btn btn-default" />
</div>
</div>
<p>
@Html.ActionLink("Register as a new user", "Register")
</p>
}
</section>
</div>
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,41 @@
@model HPlusSports.Models.RegisterViewModel
@{
ViewBag.Title = "Register";
}
<h2>@ViewBag.Title.</h2>
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<h4>Create a new account.</h4>
<hr />
@Html.ValidationSummary("", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.Password, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Register" />
</div>
</div>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,42 @@
@model HPlusSports.Models.ResetPasswordViewModel
@{
ViewBag.Title = "Reset password";
}
<h2>@ViewBag.Title.</h2>
@using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<h4>Reset your password.</h4>
<hr />
@Html.ValidationSummary("", new { @class = "text-danger" })
@Html.HiddenFor(model => model.Code)
<div class="form-group">
@Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.Password, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Reset" />
</div>
</div>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,12 @@
@{
ViewBag.Title = "Reset password confirmation";
}
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
</hgroup>
<div>
<p>
Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
</p>
</div>

View File

@ -0,0 +1,24 @@
@model HPlusSports.Models.SendCodeViewModel
@{
ViewBag.Title = "Send";
}
<h2>@ViewBag.Title.</h2>
@using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
@Html.AntiForgeryToken()
@Html.Hidden("rememberMe", @Model.RememberMe)
<h4>Send verification code</h4>
<hr />
<div class="row">
<div class="col-md-8">
Select Two-Factor Authentication Provider:
@Html.DropDownListFor(model => model.SelectedProvider, Model.Providers)
<input type="submit" value="Submit" class="btn btn-default" />
</div>
</div>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,38 @@
@model HPlusSports.Models.VerifyCodeViewModel
@{
ViewBag.Title = "Verify";
}
<h2>@ViewBag.Title.</h2>
@using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
@Html.AntiForgeryToken()
@Html.Hidden("provider", @Model.Provider)
@Html.Hidden("rememberMe", @Model.RememberMe)
<h4>Enter verification code</h4>
<hr />
@Html.ValidationSummary("", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Code, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
@Html.CheckBoxFor(m => m.RememberBrowser)
@Html.LabelFor(m => m.RememberBrowser)
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Submit" />
</div>
</div>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,28 @@
@model HPlusSports.Models.ExternalLoginListViewModel
@using Microsoft.Owin.Security
<h4>Use another service to log in.</h4>
<hr />
@{
var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes();
if (loginProviders.Count() == 0) {
<div>
<p>
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkId=403804">this article</a>
for details on setting up this ASP.NET application to support logging in via external services.
</p>
</div>
}
else {
using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) {
@Html.AntiForgeryToken()
<div id="socialLoginList">
<p>
@foreach (AuthenticationDescription p in loginProviders) {
<button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button>
}
</p>
</div>
}
}
}

View File

@ -0,0 +1,108 @@
@model HPlusSports.Models.ShoppingCart
@{
ViewBag.Title = "My Cart";
}
@if (TempData["SuccessMessage"] != null)
{
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
@TempData["SuccessMessage"]
</div>
}
<div class="cart row">
<div>
<hr />
<table class="table">
<thead>
<tr>
<th class="col-md-1">
</th>
<th class="col-md-6">
Product
</th>
<th class="col-md-1">
Quantity
</th>
<th class="col-md-2">
Price
</th>
<th class="col-md-2">
Subtotal
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Items)
{
<tr class="text-middle">
<td>
<a href="@Url.Action("Remove", "Cart", new { id = item.Id })">
<i class="glyphicon glyphicon-remove text-danger"></i>
</a>
</td>
<td>
<a href="@Url.Action("Product", "Products", new { id = item.SKU })">
<img class="product-image img-thumbnail" src="@Url.Action("Product", "Images", new { id = item.SKU })" />
<span>@item.Name</span>
</a>
</td>
<td>
<a href="@Url.Action("Add", "Cart", new { item.SKU, quantity = -1 })">
<i class="glyphicon glyphicon-minus"></i>
</a>
@item.Quantity
<a href="@Url.Action("Add", "Cart", new { item.SKU })">
<i class="glyphicon glyphicon-plus"></i>
</a>
</td>
<td>
@item.Price.ToString("C")
</td>
<td>
@item.Total.ToString("C")
</td>
</tr>
}
</tbody>
<tfoot>
<tr class="text-primary">
<td colspan="4" class="text-right">
Subtotal
</td>
<td>
@Model.Subtotal.ToString("C")
</td>
</tr>
<tr class="text-muted">
<td colspan="4" class="text-right">
Tax
</td>
<td>
@Model.Tax.ToString("C")
</td>
</tr>
<tr class="text-muted">
<td colspan="4" class="text-right">
Shipping
</td>
<td>
@Model.Shipping.ToString("C")
</td>
</tr>
<tr class="text-primary text-large">
<th colspan="4" class="text-right">
Total
</th>
<th>
@Model.Total.ToString("C")
</th>
</tr>
</tfoot>
</table>
</div>
</div>

View File

@ -0,0 +1,16 @@
@model HPlusSports.Models.ShoppingCart
@{
ViewBag.Title = "Cart";
}
<div class="row">
<div class="well well-lg">
<p>Your shopping cart is empty!</p>
<p>
Head on over to
@Html.ActionLink("the Product Catalog", "Index", "Products")
to find something!
</p>
</div>
</div>

View File

@ -0,0 +1,6 @@
@{
ViewBag.Title = "About";
}
<h3>@ViewBag.Message</h3>
<p>Use this area to provide additional information.</p>

View File

@ -0,0 +1,16 @@
@{
ViewBag.Title = "Contact";
}
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>

View File

@ -0,0 +1,19 @@
@model IDictionary<HPlusSports.Models.Category, int>
@{
ViewBag.Title = "Categories";
}
<div class="row">
@foreach (var category in Model.Keys)
{
<div class="category col-md-4 text-center">
<a href="@Url.Action("Category", "Products", new { id = category.Key })">
<img class="img-thumbnail" src="@Url.Action("Category", "Images", new { id = category.Key })" />
<h3>@category.Name</h3>
</a>
</div>
}
</div>

View File

@ -0,0 +1,95 @@
@model HPlusSports.Models.Product
@{
ViewBag.Title = "Add New Product";
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
@*
Add these hidden fields so validation doesn't fail,
even though they are going to get overridden on the
server anyway.
*@
@Html.Hidden(nameof(Model.LastUpdated), DateTime.Now.ToString())
@Html.Hidden(nameof(Model.LastUpdatedUserId), User.Identity.Name)
<div class="form-horizontal">
<h4>Product</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.CategoryId, "CategoryId", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownListFor(model => model.CategoryId, null, htmlAttributes: new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CategoryId, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.SKU, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.SKU, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.SKU, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Summary, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Summary, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Summary, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.MSRP, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.MSRP, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.MSRP, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,93 @@
@model IEnumerable<HPlusSports.Models.Product>
@{
ViewBag.Title = "Inventory";
}
@if (TempData["SuccessMessage"] != null)
{
<div class="alert alert-error alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
@TempData["SuccessMessage"]
</div>
}
else if (TempData["ErrorMessage"] != null)
{
<div class="alert alert-error alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
@TempData["ErrorMessage"]
</div>
}
<h2>
@ViewBag.Title
<a class="btn btn-primary btn-sm pull-right" href="@Url.Action("Create")">Add Product</a>
</h2>
<table class="table tablesorter">
<thead>
<tr>
<th>
Category
</th>
<th>
@Html.DisplayNameFor(model => model.SKU)
</th>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Price)
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
<th>
Last Update
</th>
<th disabled></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Category.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.SKU)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Price)
<span class="clearfix text-muted">
@Html.DisplayFor(modelItem => item.MSRP)
</span>
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
<span class="text-muted">
<span title="@item.LastUpdated.ToString()">
@item.LastUpdated.ToShortDateString()
</span>
by
@item.LastUpdatedUserId
</span>
</td>
<td>
<a href="@Url.Action("Update", new { id = item.Id })">
<i class="glyphicon glyphicon-pencil text-info"></i>
</a>
<a href="@Url.Action("Delete", new { id = item.Id })">
<i class="glyphicon glyphicon-remove text-danger"></i>
</a>
</td>
</tr>
}
</tbody>
</table>

View File

@ -0,0 +1,104 @@
@model HPlusSports.Models.Product
@{
ViewBag.Title = "Update Product";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Product</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.Id)
<div class="form-group">
@Html.LabelFor(model => model.CategoryId, "CategoryId", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownListFor(model => model.CategoryId, null, htmlAttributes: new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CategoryId, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.SKU, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.SKU, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.SKU, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Summary, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Summary, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Summary, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.MSRP, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.MSRP, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.MSRP, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastUpdated, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DisplayFor(model => model.LastUpdated, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastUpdatedUserId, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DisplayFor(model => model.LastUpdatedUserId, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -0,0 +1,82 @@
@model HPlusSports.Models.Product
@{
ViewBag.Title = "";
}
<div class="product row">
<div class="col-md-1">
@if (Model.Images.Count > 1)
{
<ul class="list-group">
@foreach (var image in Model.Images)
{
<li class="list-group-item">
<img class="img img-thumbnail"
src="@Url.Action("Image", "Images", new { id = image.Id })" />
</li>
}
</ul>
}
</div>
<div class="col-md-4">
<img class="img img-thumbnail"
src="@Url.Action("Product", "Images", new { id = Model.SKU })" />
</div>
<div class="col-md-6">
<h2>@Model.Name</h2>
<p>
@{
var rating = (HPlusSports.Models.ProductRating)ViewData["Rating"];
}
@if (rating == null || rating.ReviewCount == 0)
{
<span><em>No Rating</em></span>
}
else
{
<span title="@rating.Rating.GetValueOrDefault().ToString("N1")">
@for (var i = 1; i <= 5; i++)
{
var starClass = (rating.Rating >= i) ? "star" : "star-empty";
<span class="rating-star glyphicon glyphicon-@starClass"></span>
}
</span>
<span>(@rating.ReviewCount)</span>
}
</p>
<p>
<span class="price">@Html.DisplayFor(modelItem => modelItem.Price)</span>
<span class="text-muted">@Html.DisplayFor(modelItem => modelItem.MSRP)</span>
@{
var discount = (Model.MSRP - Model.Price) / Model.MSRP;
}
@if (discount > .05)
{
<span class="discount label label-primary">
@discount.ToString("P0") off!
</span>
}
</p>
<p class="buy-button">
<a class="btn btn-sm btn-warning" href="@Url.Action("Add", "Cart", new { Model.SKU })">
Add To Cart
</a>
</p>
<hr />
<p>
@Html.DisplayFor(model => model.Summary)
</p>
</div>
</div>

View File

@ -0,0 +1,123 @@
@using HPlusSports.Models
@model IEnumerable<HPlusSports.Models.Product>
@{
var category = (Category)ViewData["Category"];
ViewBag.Title = category.Name;
var Ratings = (IEnumerable<ProductRating>)ViewData["Ratings"];
}
<div class="paged-content">
<div class="row">
@foreach (var product in Model)
{
var discount = (product.MSRP - product.Price) / product.MSRP;
var rating = Ratings.FirstOrDefault(x => x.SKU == product.SKU);
<div class="product-summary col-md-3 text-center">
<h4>
<a href="@Url.Action("Product", "Products", new { id = product.SKU })">
<img class="product-image img-thumbnail" src="@Url.Action("Product", "Images", new { id = product.SKU })" />
<span class="name">@product.Name</span>
</a>
</h4>
<p>
<span class="price">@Html.DisplayFor(x => product.Price)</span>
<span class="text-muted">@Html.DisplayFor(x => product.MSRP)</span>
@if (discount > .05)
{
<span class="discount label label-primary">
@discount.ToString("P0") off!
</span>
}
</p>
<p>
@if (rating == null || rating.ReviewCount == 0)
{
<span><em>No Rating</em></span>
}
else
{
<span title="@rating.Rating.GetValueOrDefault().ToString("N1")">
@for (var i = 1; i <= 5; i++)
{
var starClass = (rating.Rating >= i) ? "star" : "star-empty";
<span class="rating-star glyphicon glyphicon-@starClass"></span>
}
</span>
<span>(@rating.ReviewCount)</span>
}
</p>
<p>
<a class="btn btn-sm btn-warning" href="@Url.Action("Add", "Cart", new { product.SKU })">
Add To Cart
</a>
</p>
</div>
}
</div>
<div class="pager row">
<div class="pull-left">
<nav>
<ul class="pager">
<li>
<span>
@ViewBag.ResultsCount results
</span>
</li>
</ul>
</nav>
</div>
<div class="col-md-4 text-right">
@if (ViewBag.PreviousPage != null)
{
<nav>
<ul class="pager">
<li>
<a data-partial href="?page=@ViewBag.PreviousPage&count=@ViewBag.PageSize">
<i class="glyphicon glyphicon-chevron-left"></i>
Prev.
</a>
</li>
</ul>
</nav>
}
</div>
<div class="col-md-2 text-center">
<nav>
<ul class="pager">
<li>
<span>Page @ViewBag.CurrentPage of @ViewBag.PageCount</span>
</li>
</ul>
</nav>
</div>
<div class="col-md-5 text-left">
@if (ViewBag.NextPage != null)
{
<nav>
<ul class="pager">
<li>
<a data-partial href="?page=@ViewBag.NextPage&count=@ViewBag.PageSize">
Next
<i class="glyphicon glyphicon-chevron-right"></i>
</a>
</li>
</ul>
</nav>
}
</div>
</div>
</div>

View File

@ -0,0 +1,17 @@
@model HPlusSports.Models.ProductRating
@if (Model == null || Model.ReviewCount == 0)
{
<span><em>No Rating</em></span>
}
else
{
<span title="@Model.Rating.GetValueOrDefault().ToString("N1")">
@for (var i = 1; i <= 5; i++)
{
var starClass = (Model.Rating >= i) ? "star" : "star-empty";
<span class="Model-star glyphicon glyphicon-@starClass"></span>
}
</span>
<span>(@Model.ReviewCount)</span>
}

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Error</title>
</head>
<body>
<hgroup>
<h1>Error.</h1>
<h2>An error occurred while processing your request.</h2>
</hgroup>
</body>
</html>

View File

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - H+ Sport</title>
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
<link rel="icon" href="https://hplussport.com/wp-content/uploads/2015/12/cropped-HSport_01-32x32.png" sizes="32x32">
</head>
<body>
<div class="navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="~/" class="navbar-brand">
<img src="~/Content/logo.png" />
</a>
</div>
<div class="col-md-6 text-center title navbar-header">
<h1>@ViewData["Title"]</h1>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
@if (User.IsInRole(HPlusSports.Models.UserRoles.Admin))
{
<a class="dropbtn" href="@Url.Action("Index", "Inventory")">
<i class="glyphicon glyphicon-list-alt"></i>
Inventory
</a>
}
</li>
<li class="dropdown">
@{
var cart = HPlusSports.Application.Cart;
}
<a class="dropbtn nav-cart">
<i class="glyphicon glyphicon-shopping-cart"></i>
Cart
@if (cart.Items.Any())
{
<span>
(@cart.Items.Count() items)
</span>
}
</a>
<div class="dropdown-content">
@if (cart.Items.Count == 0)
{
<p>Your shopping cart is empty - keep shopping!</p>
}
else
{
<table class="table table-condensed">
@foreach (var item in cart.Items)
{
<tr class="text-middle">
<td>
<a href="@Url.Action("Remove", "Cart", new { id = item.Id })">
<i class="glyphicon glyphicon-remove text-danger"></i>
</a>
</td>
<td>
<img width="50" height="50" src="@Url.Action("Product", "Images", new { id = item.SKU })" alt="">
</td>
<td>
<a href="@Url.Action("Product", "Products", new { id = item.SKU })">
@item.Name
</a>
</td>
<td class="text-right">
@item.Quantity
x
@item.Price.ToString("C")
</td>
</tr>
}
<tr>
<th colspan="3" class="text-right">
Subtotal:
</th>
<th class="text-right">
@cart.Subtotal.ToString("C")
</th>
</tr>
</table>
}
<p class="buttons text-right">
<a href="@Url.Action("Index", "Cart")" class="btn btn-default">View Cart</a>
</p>
</div>
</li>
<li>
@if (User.Identity.IsAuthenticated)
{
<form method="post" action="@Url.Action("Logoff", "Account", new { area = "" })">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-default">Logout</button>
</form>
}
else
{
<div>
<a href="@Url.Action("Login", "Account")" class="btn btn-default">Login</a>
</div>
}
</li>
</ul>
</div>
</div>
</div>
<div id="main" class="container">
@RenderBody()
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.30.1/js/jquery.tablesorter.min.js"></script>
@Scripts.Render("~/bundles/site")
@RenderSection("scripts", required: false)
</body>
</html>

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
</configuration>

View File

@ -0,0 +1,3 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}