Before we can let users add products to their shopping carts, we have some work to do to finish off the product details page. For a start, we have an Add to cart button, which doesn't do anything, and we have no way of determining which product variant to add to the cart even when it does.
Our products also have an array of associated images, which we aren't doing anything with, so let's start off by displaying those on the page before creating a basic image gallery component. The first step is to modify the existing controller action to return a view model for the same reasons as with the product list action. This means we'll need the following new ProductDetailsViewModel.cs class in the Features/Products folder:
namespace ECommerce.Features.Products
{
public class ProductDetailsViewModel
{
public int Id { get; set;...