Cart Updates (#26)

* ardalis/cart-updates

Updating how items are added to cart and displayed in cart.

* Cleaning up UI
This commit is contained in:
Steve Smith
2017-08-07 09:49:12 -04:00
committed by GitHub
parent b52048b74d
commit b67f8cc050
16 changed files with 258 additions and 22 deletions

View File

@@ -0,0 +1,19 @@
using Microsoft.eShopWeb.ApplicationCore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.eShopWeb.ViewModels
{
public class BasketItemViewModel
{
public string Id { get; set; }
public string ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal OldUnitPrice { get; set; }
public int Quantity { get; set; }
public string PictureUrl { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.eShopWeb.ViewModels
{
public class BasketViewModel
{
public List<BasketItemViewModel> Items { get; set; } = new List<BasketItemViewModel>();
public string BuyerId { get; set; }
public decimal Total()
{
return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity), 2);
}
}
}