Skip to content

Commit 4e5e32c

Browse files
committed
Add old price property for the basket in the WebMVC
1 parent 6617981 commit 4e5e32c

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

src/Web/WebMVC/ViewModels/BasketItem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class BasketItem
1111
public string ProductId { get; set; }
1212
public string ProductName { get; set; }
1313
public decimal UnitPrice { get; set; }
14+
public decimal OldUnitPrice { get; set; }
1415
public int Quantity { get; set; }
1516
public string PictureUrl { get; set; }
1617
}

src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,24 @@
1818
var item = Model.Items[i];
1919

2020
<article class="esh-basket-items esh-basket-items--border row">
21-
22-
<section class="esh-basket-item esh-basket-item--middle col-lg-3 hidden-lg-down">
23-
<img class="esh-basket-image" src="@item.PictureUrl" />
24-
</section>
25-
<section class="esh-basket-item esh-basket-item--middle col-xs-3">@item.ProductName</section>
26-
<section class="esh-basket-item esh-basket-item--middle col-xs-2">$ @item.UnitPrice</section>
27-
<section class="esh-basket-item esh-basket-item--middle col-xs-2">
28-
<input type="hidden" name="@("quantities[" + i +"].Key")" value="@item.Id" />
29-
<input type="number" class="esh-basket-input" min="1" name="@("quantities[" + i +"].Value")" value="@item.Quantity" />
30-
</section>
31-
<section class="esh-basket-item esh-basket-item--middle esh-basket-item--mark col-xs-2">$ @Math.Round(item.Quantity * item.UnitPrice, 2)</section>
21+
<div>
22+
<section class="esh-basket-item esh-basket-item--middle col-lg-3 hidden-lg-down">
23+
<img class="esh-basket-image" src="@item.PictureUrl" />
24+
</section>
25+
<section class="esh-basket-item esh-basket-item--middle col-xs-3">@item.ProductName</section>
26+
<section class="esh-basket-item esh-basket-item--middle col-xs-2">$ @item.UnitPrice</section>
27+
<section class="esh-basket-item esh-basket-item--middle col-xs-2">
28+
<input type="hidden" name="@("quantities[" + i +"].Key")" value="@item.Id" />
29+
<input type="number" class="esh-basket-input" min="1" name="@("quantities[" + i +"].Value")" value="@item.Quantity" />
30+
</section>
31+
<section class="esh-basket-item esh-basket-item--middle esh-basket-item--mark col-xs-2">$ @Math.Round(item.Quantity * item.UnitPrice, 2)</section>
32+
</div>
33+
@if (item.OldUnitPrice != 0)
34+
{
35+
<div class="esh-basket-item">
36+
The price of the item has changed. Old price was @item.OldUnitPrice $
37+
</div>
38+
}
3239
</article>
3340
}
3441
</div>

0 commit comments

Comments
 (0)