From 0299de4fdde9e7c2eb8a97b0346b494dc1da465d Mon Sep 17 00:00:00 2001 From: Claus Date: Fri, 9 Sep 2016 13:31:43 +0200 Subject: [PATCH] adding in stream methods for partial views. --- src/Umbraco.Core/Services/FileService.cs | 16 ++++++++++++++++ src/Umbraco.Core/Services/IFileService.cs | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/Umbraco.Core/Services/FileService.cs b/src/Umbraco.Core/Services/FileService.cs index 326d450c93..af449d7cfa 100644 --- a/src/Umbraco.Core/Services/FileService.cs +++ b/src/Umbraco.Core/Services/FileService.cs @@ -858,6 +858,22 @@ namespace Umbraco.Core.Services } } + public Stream GetPartialViewFileContentStream(string filepath) + { + using (var repository = GetPartialViewRepository(PartialViewType.PartialView, UowProvider.GetUnitOfWork())) + { + return repository.GetFileContentStream(filepath); + } + } + + public void SetPartialViewFileContent(string filepath, Stream content) + { + using (var repository = GetPartialViewRepository(PartialViewType.PartialView, UowProvider.GetUnitOfWork())) + { + repository.SetFileContent(filepath, content); + } + } + #endregion private void Audit(AuditType type, string message, int userId, int objectId) diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index 03ebdac029..5fa078e79b 100644 --- a/src/Umbraco.Core/Services/IFileService.cs +++ b/src/Umbraco.Core/Services/IFileService.cs @@ -293,5 +293,19 @@ namespace Umbraco.Core.Services /// The filesystem path to the macro partial view. /// The content of the macro partial view. void SetPartialViewMacroFileContent(string filepath, Stream content); + + /// + /// Gets the content of a partial view as a stream. + /// + /// The filesystem path to the partial view. + /// The content of the partial view. + Stream GetPartialViewFileContentStream(string filepath); + + /// + /// Sets the content of a partial view. + /// + /// The filesystem path to the partial view. + /// The content of the partial view. + void SetPartialViewFileContent(string filepath, Stream content); } } \ No newline at end of file