Пример #1
0
        public async Task <IActionResult> CreateImage(int productId, [FromForm] ProductImageCreateRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var imageId = await _manageProductService.AddImages(productId, request);

            if (imageId == 0)
            {
                return(BadRequest());
            }
            var image = await _manageProductService.GetImageById(imageId);

            return(CreatedAtAction(nameof(GetImageById), new { id = imageId }));
        }