Initial Upgrade to .NET Core 2.0 (#50)
* Ardalis/upgrade1 (#44) * Upgrading to netcore 2.0 Updating repository to support async options and refactoring to use it. * Starting work on tracking customer orders feature. * Cleaning up some bugs Working on basket view component implementation * Fixing up styles, especially for basket in header. * Adding Order Features (#47) * Working on order model binding from checkout page - WIP * Small layout tweaks (#43) * Updating quantities implemented. * Fixed basket widget count * Order History (#49) * working on creating and viewing orders. * Working on wiring up listing of orders * List orders page works as expected. Needed to support ThenInclude scenarios. Currently using strings.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
@using Microsoft.eShopWeb.ViewModels
|
||||
@model BasketViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Basket";
|
||||
@model BasketViewModel
|
||||
}
|
||||
<section class="esh-catalog-hero">
|
||||
<div class="container">
|
||||
@@ -23,9 +23,10 @@
|
||||
<section class="esh-basket-title col-xs-2">Cost</section>
|
||||
</article>
|
||||
<div class="esh-catalog-items row">
|
||||
@foreach (var item in Model.Items)
|
||||
@for (int i=0; i< Model.Items.Count; i++)
|
||||
{
|
||||
<article class="esh-basket-items row">
|
||||
var item = Model.Items[i];
|
||||
<article class="esh-basket-items row">
|
||||
<div>
|
||||
<section class="esh-basket-item esh-basket-item--middle col-lg-3 hidden-lg-down">
|
||||
<img class="esh-basket-image" src="@item.PictureUrl" />
|
||||
@@ -33,8 +34,8 @@
|
||||
<section class="esh-basket-item esh-basket-item--middle col-xs-3">@item.ProductName</section>
|
||||
<section class="esh-basket-item esh-basket-item--middle col-xs-2">$ @item.UnitPrice.ToString("N2")</section>
|
||||
<section class="esh-basket-item esh-basket-item--middle col-xs-2">
|
||||
<input type="hidden" name="@("quantities[" + item.Id +"].Key")" value="@item.Id" />
|
||||
<input type="number" class="esh-basket-input" min="1" name="@("quantities[" + item.Id +"].Value")" value="@item.Quantity" />
|
||||
<input type="hidden" name="@("Items[" + i + "].Key")" value="@item.Id" />
|
||||
<input type="number" class="esh-basket-input" min="1" name="@("Items[" + i + "].Value")" value="@item.Quantity" />
|
||||
</section>
|
||||
<section class="esh-basket-item esh-basket-item--middle esh-basket-item--mark col-xs-2">$ @Math.Round(item.Quantity * item.UnitPrice, 2).ToString("N2")</section>
|
||||
</div>
|
||||
@@ -65,7 +66,9 @@
|
||||
</article>
|
||||
</div>
|
||||
}
|
||||
<section class="esh-basket-item col-xs-push-9 col-xs-3">
|
||||
<section class="esh-basket-item col-xs-push-8 col-xs-4">
|
||||
<button class="btn esh-basket-checkout" name="updatebutton" value="" type="submit"
|
||||
asp-action="Update">[ Update ]</button>
|
||||
<input type="submit" asp-action="Checkout"
|
||||
class="btn esh-basket-checkout"
|
||||
value="[ Checkout ]" name="action" />
|
||||
|
||||
88
src/Web/Views/Order/Detail.cshtml
Normal file
88
src/Web/Views/Order/Detail.cshtml
Normal file
@@ -0,0 +1,88 @@
|
||||
@using Microsoft.eShopWeb.ViewModels
|
||||
@model OrderViewModel
|
||||
@{
|
||||
ViewData["Title"] = "My Order History";
|
||||
}
|
||||
@{
|
||||
ViewData["Title"] = "Order Detail";
|
||||
}
|
||||
|
||||
<div class="esh-orders_detail">
|
||||
<div class="container">
|
||||
<section class="esh-orders_detail-section">
|
||||
<article class="esh-orders_detail-titles row">
|
||||
<section class="esh-orders_detail-title col-xs-3">Order number</section>
|
||||
<section class="esh-orders_detail-title col-xs-3">Date</section>
|
||||
<section class="esh-orders_detail-title col-xs-3">Total</section>
|
||||
<section class="esh-orders_detail-title col-xs-3">Status</section>
|
||||
</article>
|
||||
|
||||
<article class="esh-orders_detail-items row">
|
||||
<section class="esh-orders_detail-item col-xs-3">@Model.OrderNumber</section>
|
||||
<section class="esh-orders_detail-item col-xs-3">@Model.OrderDate</section>
|
||||
<section class="esh-orders_detail-item col-xs-3">$@Model.Total</section>
|
||||
<section class="esh-orders_detail-title col-xs-3">@Model.Status</section>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@*<section class="esh-orders_detail-section">
|
||||
<article class="esh-orders_detail-titles row">
|
||||
<section class="esh-orders_detail-title col-xs-12">Description</section>
|
||||
</article>
|
||||
|
||||
<article class="esh-orders_detail-items row">
|
||||
<section class="esh-orders_detail-item col-xs-12">@Model.Description</section>
|
||||
</article>
|
||||
</section>*@
|
||||
|
||||
<section class="esh-orders_detail-section">
|
||||
<article class="esh-orders_detail-titles row">
|
||||
<section class="esh-orders_detail-title col-xs-12">Shipping Address</section>
|
||||
</article>
|
||||
|
||||
<article class="esh-orders_detail-items row">
|
||||
<section class="esh-orders_detail-item col-xs-12">@Model.ShippingAddress.Street</section>
|
||||
</article>
|
||||
|
||||
<article class="esh-orders_detail-items row">
|
||||
<section class="esh-orders_detail-item col-xs-12">@Model.ShippingAddress.City</section>
|
||||
</article>
|
||||
|
||||
<article class="esh-orders_detail-items row">
|
||||
<section class="esh-orders_detail-item col-xs-12">@Model.ShippingAddress.Country</section>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="esh-orders_detail-section">
|
||||
<article class="esh-orders_detail-titles row">
|
||||
<section class="esh-orders_detail-title col-xs-12">ORDER DETAILS</section>
|
||||
</article>
|
||||
|
||||
@for (int i = 0; i < Model.OrderItems.Count; i++)
|
||||
{
|
||||
var item = Model.OrderItems[i];
|
||||
<article class="esh-orders_detail-items esh-orders_detail-items--border row">
|
||||
<section class="esh-orders_detail-item col-md-4 hidden-md-down">
|
||||
<img class="esh-orders_detail-image" src="@item.PictureUrl">
|
||||
</section>
|
||||
<section class="esh-orders_detail-item esh-orders_detail-item--middle col-xs-4">@item.ProductName</section>
|
||||
<section class="esh-orders_detail-item esh-orders_detail-item--middle col-xs-1">$ @item.UnitPrice.ToString("N2")</section>
|
||||
<section class="esh-orders_detail-item esh-orders_detail-item--middle col-xs-1">@item.Units</section>
|
||||
<section class="esh-orders_detail-item esh-orders_detail-item--middle col-xs-2">$ @Math.Round(item.Units * item.UnitPrice, 2).ToString("N2")</section>
|
||||
</article>
|
||||
}
|
||||
</section>
|
||||
|
||||
<section class="esh-orders_detail-section esh-orders_detail-section--right">
|
||||
<article class="esh-orders_detail-titles esh-basket-titles--clean row">
|
||||
<section class="esh-orders_detail-title col-xs-9"></section>
|
||||
<section class="esh-orders_detail-title col-xs-2">TOTAL</section>
|
||||
</article>
|
||||
|
||||
<article class="esh-orders_detail-items row">
|
||||
<section class="esh-orders_detail-item col-xs-9"></section>
|
||||
<section class="esh-orders_detail-item esh-orders_detail-item--mark col-xs-2">$ @Model.Total</section>
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
39
src/Web/Views/Order/Index.cshtml
Normal file
39
src/Web/Views/Order/Index.cshtml
Normal file
@@ -0,0 +1,39 @@
|
||||
@using Microsoft.eShopWeb.ViewModels
|
||||
@model IEnumerable<OrderViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "My Order History";
|
||||
}
|
||||
|
||||
<div class="esh-orders">
|
||||
<div class="container">
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
<article class="esh-orders-titles row">
|
||||
<section class="esh-orders-title col-xs-2">Order number</section>
|
||||
<section class="esh-orders-title col-xs-4">Date</section>
|
||||
<section class="esh-orders-title col-xs-2">Total</section>
|
||||
<section class="esh-orders-title col-xs-2">Status</section>
|
||||
<section class="esh-orders-title col-xs-2"></section>
|
||||
</article>
|
||||
@if (Model != null && Model.Any())
|
||||
{
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<article class="esh-orders-items row">
|
||||
<section class="esh-orders-item col-xs-2">@Html.DisplayFor(modelItem => item.OrderNumber)</section>
|
||||
<section class="esh-orders-item col-xs-4">@Html.DisplayFor(modelItem => item.OrderDate)</section>
|
||||
<section class="esh-orders-item col-xs-2">$ @Html.DisplayFor(modelItem => item.Total)</section>
|
||||
<section class="esh-orders-item col-xs-2">@Html.DisplayFor(modelItem => item.Status)</section>
|
||||
<section class="esh-orders-item col-xs-1">
|
||||
<a class="esh-orders-link" asp-controller="Order" asp-action="Detail" asp-route-orderId="@item.OrderNumber">Detail</a>
|
||||
</section>
|
||||
<section class="esh-orders-item col-xs-1">
|
||||
@if (item.Status.ToLower() == "submitted")
|
||||
{
|
||||
<a class="esh-orders-link" asp-controller="Order" asp-action="cancel" asp-route-orderId="@item.OrderNumber">Cancel</a>
|
||||
}
|
||||
</section>
|
||||
</article>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
17
src/Web/Views/Shared/Components/Basket/Default.cshtml
Normal file
17
src/Web/Views/Shared/Components/Basket/Default.cshtml
Normal file
@@ -0,0 +1,17 @@
|
||||
@model BasketComponentViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "My Basket";
|
||||
}
|
||||
|
||||
<a class="esh-basketstatus "
|
||||
asp-area=""
|
||||
asp-controller="Basket"
|
||||
asp-action="Index">
|
||||
<div class="esh-basketstatus-image">
|
||||
<img src="~/images/cart.png" />
|
||||
</div>
|
||||
<div class="esh-basketstatus-badge">
|
||||
@Model.ItemsCount
|
||||
</div>
|
||||
</a>
|
||||
@@ -15,8 +15,12 @@
|
||||
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||
<link rel="stylesheet" href="~/css/app.min.css" asp-append-version="true" />
|
||||
</environment>
|
||||
<link rel="stylesheet" href="~/css/catalog/pager.css" />
|
||||
<link rel="stylesheet" href="~/css/catalog/catalog.component.css" />
|
||||
<link rel="stylesheet" href="~/css/app.component.css" />
|
||||
<link rel="stylesheet" href="~/css/basket/basket.component.css" />
|
||||
<link rel="stylesheet" href="~/css/catalog/pager.css" />
|
||||
<link rel="stylesheet" href="~/css/catalog/catalog.component.css" />
|
||||
<link rel="stylesheet" href="~/css/basket/basket-status/basket-status.component.css" />
|
||||
<link rel="stylesheet" href="~/css/orders/orders.component.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header class="navbar navbar-light navbar-static-top">
|
||||
@@ -43,7 +47,6 @@
|
||||
<article class="row">
|
||||
|
||||
<section class="col-sm-6">
|
||||
<img class="esh-app-footer-brand" src="../images/brand_dark.png" />
|
||||
</section>
|
||||
|
||||
<section class="col-sm-6">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@*@inject IIdentityParser<ApplicationUser> UserManager*@
|
||||
|
||||
@if (Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
@@ -14,13 +13,13 @@
|
||||
|
||||
<section class="esh-identity-drop">
|
||||
|
||||
@*<a class="esh-identity-item"
|
||||
<a class="esh-identity-item"
|
||||
asp-controller="Order"
|
||||
asp-action="Index">
|
||||
|
||||
<div class="esh-identity-name esh-identity-name--upper">My orders</div>
|
||||
<img class="esh-identity-image" src="~/images/my_orders.png">
|
||||
</a>*@
|
||||
</a>
|
||||
|
||||
<a class="esh-identity-item"
|
||||
href="javascript:document.getElementById('logoutForm').submit()">
|
||||
@@ -33,9 +32,9 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@*<section class="col-lg-1 col-xs-12">
|
||||
@await Component.InvokeAsync("Basket", new { user = UserManager.Parse(User) })
|
||||
</section>*@
|
||||
<section class="col-lg-1 col-xs-12">
|
||||
@await Component.InvokeAsync("Basket", User.Identity.Name)
|
||||
</section>
|
||||
|
||||
}
|
||||
else
|
||||
@@ -53,5 +52,7 @@ else
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@*<section class="col-lg-1 col-xs-12"></section>*@
|
||||
<section class="col-lg-1 col-xs-12">
|
||||
@await Component.InvokeAsync("Basket")
|
||||
</section>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user