コード例 #1
0
        public IActionResult ProductDetails(int?productId)
        {
            if (!productId.HasValue)
            {
                return(NotFound());
            }
            var product = _ProductData.GetProductById(productId.Value);

            return(View(new ProductViewModel
            {
                Id = product.Id,
                Name = product.Name,
                ImageUrl = product.ImageUrl,
                Order = product.Order,
                Price = product.Price,
                Brand = product.Brand.Name
            }));
        }