public IActionResult Details(int id) { ViewData["BodyClass"] = "product-page"; var detail = new DetailViewModel(); detail.Product = _productService.GetById(id); detail.Category = _productCategoryService.GetById(detail.Product.CategoryId); detail.ProductImages = _productService.GetImages(id); detail.RelatedProducts = _productService.GetRelatedProducts(id, 5); detail.UpsellProducts = _productService.GetUpSellProducts(5); detail.Colors = _colorDapperService.GetColors(id).Select(n => new SelectListItem() { Value = n.Id.ToString(), Text = n.Name }).ToList(); detail.Sizes = _sizesDapperService.GetSizes(id).Select(n => new SelectListItem() { Value = n.Id.ToString(), Text = n.Name }).ToList(); detail.Tags = _productService.GetProductTags(id); return(View(detail)); }
public IActionResult GetSizes(int productId) { var sizes = _sizeDapperService.GetSizes(productId); return(new OkObjectResult(sizes)); }