예제 #1
0
        public async Task <JsonResult> UploadImage(ImageStorageUploadViewModel model)
        {
            CloudinaryStorage cloudinaryStorage = new CloudinaryStorage();
            string            url           = cloudinaryStorage.Cloudinary(model.Image, model.Name);
            Guid            guid            = Guid.NewGuid();
            ImageStorageDTO imageStorageDTO = new ImageStorageDTO()
            {
                Name             = model.Name,
                URL              = url,
                ConcurrencyStamp = guid.ToString()
            };

            ImageStorage imageStorage = mapper.Map <ImageStorage>(imageStorageDTO);

            imageStorageService.Insert(imageStorage);

            await SaveAsync();

            return(Json($"The Image Uploaded and is located at the following link \n {url}"));
        }