diff options
Diffstat (limited to 'ExamTemplate')
| -rw-r--r-- | ExamTemplate/Services/CloudinaryService.cs | 3 | ||||
| -rw-r--r-- | ExamTemplate/Services/Interfaces/ICloudinaryService.cs | 11 | ||||
| -rw-r--r-- | ExamTemplate/Web/Startup.cs | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/ExamTemplate/Services/CloudinaryService.cs b/ExamTemplate/Services/CloudinaryService.cs index 03b7265..ef421e7 100644 --- a/ExamTemplate/Services/CloudinaryService.cs +++ b/ExamTemplate/Services/CloudinaryService.cs @@ -5,10 +5,11 @@ using System.Threading.Tasks; using CloudinaryDotNet; using CloudinaryDotNet.Actions; using Microsoft.AspNetCore.Http; +using ExamTemplate.Services.Interfaces; namespace ExamTemplate.Services { - public class CloudinaryService + public class CloudinaryService : ICloudinaryService { // Regex for getting the filename without (final) filename extension // So, from image.png, it will match image, and from doc.my.txt will match doc.my diff --git a/ExamTemplate/Services/Interfaces/ICloudinaryService.cs b/ExamTemplate/Services/Interfaces/ICloudinaryService.cs new file mode 100644 index 0000000..9c4d884 --- /dev/null +++ b/ExamTemplate/Services/Interfaces/ICloudinaryService.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; + +namespace ExamTemplate.Services.Interfaces +{ + public interface ICloudinaryService + { + Task<List<string>> UploadFilesToCloud(List<IFormFile> formFiles); + } +} diff --git a/ExamTemplate/Web/Startup.cs b/ExamTemplate/Web/Startup.cs index d627c52..ec479a7 100644 --- a/ExamTemplate/Web/Startup.cs +++ b/ExamTemplate/Web/Startup.cs @@ -34,7 +34,7 @@ namespace ExamTemplate.Web * Dependency Injection configuration
*/
- services.AddTransient<CloudinaryService>(options =>
+ services.AddTransient<ICloudinaryService, CloudinaryService>(options =>
new CloudinaryService(
cloudName: this.Configuration.GetSection("Cloud").GetSection("cloudName").Value,
apiKey: this.Configuration.GetSection("Cloud").GetSection("apiKey").Value,
|
