コード例 #1
0
        public async Task <IActionResult> DeleteImage(int productId, int imageId)
        {
            var result = await _manageProductService.RemoveImage(productId, imageId);

            if (result == 0)
            {
                return(BadRequest());
            }
            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> RemoveImage(int imageId)
        {
            var result = await _manageProductService.RemoveImage(imageId);

            if (result == 0)
            {
                return(NotFound("Cannot find product"));
            }

            return(Ok());
        }
コード例 #3
0
        public async Task <IActionResult> RemoveImage(int imageId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var result = await _manageProductService.RemoveImage(imageId);

            if (result == 0)
            {
                return(BadRequest());
            }
            return(Ok());
        }
コード例 #4
0
        public async Task <ActionResult> RemoveImage(int productId, int imageId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var image = await _manageProductService.RemoveImage(imageId);

            if (productId == 0)
            {
                return(BadRequest());
            }
            //return Created(nameof(GetById), productId);
            //return CreatedAtAction(nameof(GetImageById), new { id = imageId }, image);
            return(Ok());
        }