public IActionResult GetAllByProductId(int productId)
        {
            Thread.Sleep(1000);
            var result = _productImageService.GetAllByProductId(productId);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public async Task <IViewComponentResult> InvokeAsync(int id)
        {
            //var productimage = _productImageService.GetAllAsync();
            var productImageListDto = _mapper.Map <List <ProductImageDetailListDto> >(await _productImageService.GetAllByProductId(id));

            return(View(productImageListDto));
        }
Example #3
0
        public async Task <IActionResult> ProductImageList(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index").ShowMessage(Status.Error, "Hata", "Hatalı istek! Lütfen yeniden deneyiniz."));
            }

            if (!await _productService.ProductExistsAsync(id.Value))
            {
                return(RedirectToAction("Index").ShowMessage(Status.Error, "Hata", "Ürün bulunamadı!"));
            }

            var ProductImageListDto = _mapper.Map <ProductImageListDto>(await _productService.FindByIdAsync(id.Value));

            ProductImageListDto.ProductImages = _mapper.Map <List <ProductImageDetailListDto> >(await _productImageService.GetAllByProductId(id.Value));

            return(View(ProductImageListDto));
        }