Example #1
0
        public async Task <Image> CreateAsync(IFormFile imageSource)
        {
            var compleateUrl = await ApplicationCloudinary.UploadFileAsync(this.cloudinary, imageSource);

            var url   = compleateUrl.Replace(this.imagePathPrefix, string.Empty);
            var image = new Image {
                Url = url
            };

            await this.imagesRepository.AddAsync(image);

            await this.imagesRepository.SaveChangesAsync();

            return(image);
        }
Example #2
0
 private async Task <string> UploadToCloudAsync(IFormFile imageSource)
 => await ApplicationCloudinary.UploadFileAsync(this.cloudinary, imageSource);