コード例 #1
0
ファイル: PhotoController.cs プロジェクト: tiensinh24/Shine
        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>()));
        }