public async Task <ApiResponse> GetAllProductImageById([FromRoute] Guid id) { var images = await _productImageService.GetProductImageByProductId(id); if (images == null) { return(new ApiResponse("Không có ảnh của sản phẩm", images, 400)); } var vm = _mapper.Map <List <ProductImageViewModel> >(images); return(new ApiResponse("success", vm, 200)); }
public async Task <IActionResult> GetProductDetail(Guid ID) { ViewBag.Categories = await _categoryService.GetCategoryMenuHomepage(); ViewBag.CategoriesLevel2 = await _categoryService.GetCategoryLever2(); ViewBag.Products = await _productService.GetProductByProductId(ID); ViewBag.ProductSize = await _productSizeService.GetProductSizeByProductId(ID); ViewBag.ProductImage = await _productImageService.GetProductImageByProductId(ID); //var products = await _productService.GetProductByProductId(ID); //var productSize = await _productSizeService.GetProductSizeByProductId(ID); //var productImage = await _productImageService.GetProductImageByProductId(ID); //var models = new ProductDetailModel() //{ // ProductViewModel = products, // ProductSizeViewModel =productSize, // ProductImageViewModel =productImage, //}; return(View()); }