Exemple #1
0
        public IActionResult Upload(IFormFile file, int?brandId)
        {
            var filename = _fileManager.Upload(file);
            var publicId = _cloudinaryService.Store(filename);

            _fileManager.Delete(filename);

            if (brandId != null)
            {
                ProductBrand brandPhoto = new ProductBrand
                {
                    Image = publicId,
                };
                _departmentRepository.AddPhoto(brandPhoto);
            }

            return(Ok(new
            {
                filename = publicId,
                src = _cloudinaryService.BuildUrl(publicId)
            }));
        }