Example #1
0
        public async Task <ActionResult <PhotoForProductDto> > AddPhotoForProduct(int productId, [FromForm] IFormFile file)
        {
            var photo = await _repository.AddPhotoForProductAsync(productId, file);

            if (photo != null)
            {
                await _repository.CommitAsync();
            }

            return(CreatedAtAction(nameof(GetPhoto), new { photoId = photo.PhotoId }, photo.Adapt <PhotoForProductDto>()));
        }