|
|
|
@@ -6,9 +6,11 @@ namespace SecureSharing.Infrastructure; |
|
|
|
public sealed class ModelFactory : IModelFactory |
|
|
|
{ |
|
|
|
private readonly IMessageService _messageService; |
|
|
|
private readonly string _basePath; |
|
|
|
|
|
|
|
public ModelFactory(IMessageService messageService) |
|
|
|
public ModelFactory(IMessageService messageService, IWebHostEnvironment webHostEnvironment) |
|
|
|
{ |
|
|
|
_basePath = Path.Combine(webHostEnvironment.WebRootPath.Split('/')[0], "files"); |
|
|
|
_messageService = messageService; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -52,6 +54,7 @@ public sealed class ModelFactory : IModelFactory |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Directory.Delete(Path.Combine(_basePath, message.Code.ToString()), true); |
|
|
|
await _messageService.Delete(message.Id); |
|
|
|
} |
|
|
|
} |