Compare commits
No commits in common. "8dff8292b3f8a0f4ab065057277ba8cc4da72451" and "a24fe02bbd9ed6f6b8106aba0edfbd6b8944a147" have entirely different histories.
8dff8292b3
...
a24fe02bbd
|
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using SportsStore.WebUI.Models;
|
|
||||||
|
|
||||||
namespace SportsStore.WebUI.Controllers
|
namespace SportsStore.WebUI.Controllers
|
||||||
{
|
{
|
||||||
|
@ -18,15 +17,6 @@ namespace SportsStore.WebUI.Controllers
|
||||||
repository = repo;
|
repository = repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewResult Index(string returnUrl)
|
|
||||||
{
|
|
||||||
return View(new CartIndexViewModel
|
|
||||||
{
|
|
||||||
Cart = GetCart(),
|
|
||||||
ReturnUrl = returnUrl
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: Cart
|
// GET: Cart
|
||||||
public RedirectToRouteResult AddToCart(int productId, string returnUrl)
|
public RedirectToRouteResult AddToCart(int productId, string returnUrl)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using SportsStore.Domain.Entities;
|
|
||||||
|
|
||||||
namespace SportsStore.WebUI.Models
|
|
||||||
{
|
|
||||||
public class CartIndexViewModel
|
|
||||||
{
|
|
||||||
public Cart Cart { get; set; }
|
|
||||||
public string ReturnUrl { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -138,7 +138,6 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="HtmlHelpers\PagingHelpers.cs" />
|
<Compile Include="HtmlHelpers\PagingHelpers.cs" />
|
||||||
<Compile Include="Infrastructure\NinjectDependencyResolver.cs" />
|
<Compile Include="Infrastructure\NinjectDependencyResolver.cs" />
|
||||||
<Compile Include="Models\CartIndexViewModel.cs" />
|
|
||||||
<Compile Include="Models\PagingInfo.cs" />
|
<Compile Include="Models\PagingInfo.cs" />
|
||||||
<Compile Include="Models\ProductsListViewModel.cs" />
|
<Compile Include="Models\ProductsListViewModel.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
@ -152,7 +151,6 @@
|
||||||
<Content Include="Scripts\jquery-1.9.0.min.map" />
|
<Content Include="Scripts\jquery-1.9.0.min.map" />
|
||||||
<Content Include="Views\Shared\ProductSummary.cshtml" />
|
<Content Include="Views\Shared\ProductSummary.cshtml" />
|
||||||
<Content Include="Views\Nav\Menu.cshtml" />
|
<Content Include="Views\Nav\Menu.cshtml" />
|
||||||
<Content Include="Views\Cart\Index.cshtml" />
|
|
||||||
<None Include="Web.Debug.config">
|
<None Include="Web.Debug.config">
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
|
@ -162,6 +160,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
|
<Folder Include="Views\Cart\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SportsStore.Domain\SportsStore.Domain.csproj">
|
<ProjectReference Include="..\SportsStore.Domain\SportsStore.Domain.csproj">
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
@model SportsStore.WebUI.Models.CartIndexViewModel
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewBag.Title = "Sports Store: Your Cart";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>Your cart</h2>
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Quantity</th>
|
|
||||||
<th>Item</th>
|
|
||||||
<th class="text-right">Price</th>
|
|
||||||
<th class="text-right">Subtotal</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var line in Model.Cart.Lines) {
|
|
||||||
<tr>
|
|
||||||
<td class="text-center">@line.Quantity</td>
|
|
||||||
<td class="text-left">@line.Product.Name</td>
|
|
||||||
<td class="text-right">@line.Product.Price.ToString("c")</td>
|
|
||||||
<td class="text-right">
|
|
||||||
@((line.Quantity * line.Product.Price).ToString("c"))
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3" class="text-right">Total:</td>
|
|
||||||
<td class="text-right">
|
|
||||||
@Model.Cart.ComputeTotalValue().ToString("c")
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
<a class="btn btn-primary" href="@Model.ReturnUrl">Continue shopping</a>
|
|
||||||
</div>
|
|
||||||
|
|
Loading…
Reference in New Issue