[HttpGet("/cart")] | |
public IActionResult CartHtml2() | |
{ | |
var cart = GetShoppingCart(); | |
var vm = new ShoppingCartViewModel(); | |
vm.Products = cart.Products.Select(x => new ShoppingCartProduct | |
{ | |
Id = x.ProductId, | |
Product = x.Name, | |
Colour = x.Colour, | |
Size = x.Size, | |
Price = x.Price, | |
Links = new List<Link> | |
{ | |
new Link | |
{ | |
Rel = "ProductDetail", | |
Href = _urlHelper.Action("Product", new { Id = x.ProductId }) | |
} | |
}, | |
Actions = new List<Link> | |
{ | |
new Link | |
{ | |
Rel = "ChangeQuantity", | |
Href = _urlHelper.Action("ChangeQuantity", "Cart", new { Id = x.ProductId }) | |
} | |
} | |
}); | |
return View(vm); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment