Пример #1
0
        public IActionResult GetById(int id)
        {
            var result = _imagesService.GetImagesByProductId(id);

            if (result.Success)
            {
                return(Ok(result.Data));
            }

            return(BadRequest(result));
        }
        public IActionResult Edit(int id)
        {
            var result = _productService.Get(id);

            if (result.Success)
            {
                var images = _productImageService.GetImagesByProductId(id);
                ViewBag.Images = images;
                return(View(result.Data));
            }

            return(View("ErrorPage", result));
        }
Пример #3
0
        public IActionResult GetImagesByProductId(int productId)
        {
            var result = _productImageService.GetImagesByProductId(productId);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Пример #4
0
        public IActionResult GetImagesByProductId(int id)
        {
            QueryableBaseResponse <ProductImage> result = null;

            try
            {
                result = _productImageService.GetImagesByProductId(id);
                if (result.code == ResponseCode.SUCCESS)
                {
                    return(Ok(result.queryableResponse));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }