aboutsummaryrefslogtreecommitdiff
path: root/ExamTemplate
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-12 16:26:26 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-12 16:26:26 +0300
commit3ba9108bc24f0419a552f535fbc7495071884e97 (patch)
tree56eb2a857646305472693bad7a3ac1ee5773da3c /ExamTemplate
parente31d09d1ef195bbcc1f8455d58f401125a3050a9 (diff)
downloadit-kariera-exam-template-3ba9108bc24f0419a552f535fbc7495071884e97.tar
it-kariera-exam-template-3ba9108bc24f0419a552f535fbc7495071884e97.tar.gz
it-kariera-exam-template-3ba9108bc24f0419a552f535fbc7495071884e97.zip
Implemented Cloudinary interface
Diffstat (limited to 'ExamTemplate')
-rw-r--r--ExamTemplate/Services/CloudinaryService.cs3
-rw-r--r--ExamTemplate/Services/Interfaces/ICloudinaryService.cs11
-rw-r--r--ExamTemplate/Web/Startup.cs2
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,