Add old price property for the basket in the WebMVC

This commit is contained in:
dsanz 2017-03-13 12:15:41 +01:00
parent 6617981303
commit 4e5e32c6aa
2 changed files with 19 additions and 11 deletions

View File

@ -11,6 +11,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
public string ProductId { get; set; } public string ProductId { get; set; }
public string ProductName { get; set; } public string ProductName { get; set; }
public decimal UnitPrice { get; set; } public decimal UnitPrice { get; set; }
public decimal OldUnitPrice { get; set; }
public int Quantity { get; set; } public int Quantity { get; set; }
public string PictureUrl { get; set; } public string PictureUrl { get; set; }
} }

View File

@ -18,17 +18,24 @@
var item = Model.Items[i]; var item = Model.Items[i];
<article class="esh-basket-items esh-basket-items--border row"> <article class="esh-basket-items esh-basket-items--border row">
<div>
<section class="esh-basket-item esh-basket-item--middle col-lg-3 hidden-lg-down"> <section class="esh-basket-item esh-basket-item--middle col-lg-3 hidden-lg-down">
<img class="esh-basket-image" src="@item.PictureUrl" /> <img class="esh-basket-image" src="@item.PictureUrl" />
</section> </section>
<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-3">@item.ProductName</section>
<section class="esh-basket-item esh-basket-item--middle col-xs-2">$ @item.UnitPrice</section> <section class="esh-basket-item esh-basket-item--middle col-xs-2">$ @item.UnitPrice</section>
<section class="esh-basket-item esh-basket-item--middle col-xs-2"> <section class="esh-basket-item esh-basket-item--middle col-xs-2">
<input type="hidden" name="@("quantities[" + i +"].Key")" value="@item.Id" /> <input type="hidden" name="@("quantities[" + i +"].Key")" value="@item.Id" />
<input type="number" class="esh-basket-input" min="1" name="@("quantities[" + i +"].Value")" value="@item.Quantity" /> <input type="number" class="esh-basket-input" min="1" name="@("quantities[" + i +"].Value")" value="@item.Quantity" />
</section> </section>
<section class="esh-basket-item esh-basket-item--middle esh-basket-item--mark col-xs-2">$ @Math.Round(item.Quantity * item.UnitPrice, 2)</section> <section class="esh-basket-item esh-basket-item--middle esh-basket-item--mark col-xs-2">$ @Math.Round(item.Quantity * item.UnitPrice, 2)</section>
</div>
@if (item.OldUnitPrice != 0)
{
<div class="esh-basket-item">
The price of the item has changed. Old price was @item.OldUnitPrice $
</div>
}
</article> </article>
} }
</div> </div>