From 882b1f6df5fde43851bf720f7239e71d3efeff8f Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Tue, 6 Jul 2010 19:00:49 -0700 Subject: [PATCH] Moving action result into its own file --HG-- branch : dev --- .../Orchard.Modules/Orchard.Modules.csproj | 1 + .../Controllers/DownloadStreamResult.cs | 24 ++++++++++++++++++- .../Controllers/PackagingController.cs | 20 ---------------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Orchard.Modules.csproj b/src/Orchard.Web/Modules/Orchard.Modules/Orchard.Modules.csproj index 234c409b8..0330107b4 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Orchard.Modules.csproj +++ b/src/Orchard.Web/Modules/Orchard.Modules/Orchard.Modules.csproj @@ -75,6 +75,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/DownloadStreamResult.cs b/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/DownloadStreamResult.cs index 5f282702b..d4807f89c 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/DownloadStreamResult.cs +++ b/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/DownloadStreamResult.cs @@ -1 +1,23 @@ - \ No newline at end of file +using System.IO; +using System.Web.Mvc; + +namespace Orchard.Modules.Packaging.Controllers { + public class DownloadStreamResult : ActionResult { + public string FileName { get; set; } + public string ContentType { get; set; } + public Stream Stream { get; set; } + + public DownloadStreamResult(string fileName, string contentType, Stream stream) { + FileName = fileName; + ContentType = contentType; + Stream = stream; + } + + public override void ExecuteResult(ControllerContext context) { + context.HttpContext.Response.ContentType = ContentType; + context.HttpContext.Response.AddHeader("content-disposition", "attachment; filename=\"" + FileName + "\""); + Stream.Seek(0, SeekOrigin.Begin); + Stream.CopyTo(context.HttpContext.Response.OutputStream); + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/PackagingController.cs b/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/PackagingController.cs index fdba015c4..631b14911 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/PackagingController.cs +++ b/src/Orchard.Web/Modules/Orchard.Modules/Packaging/Controllers/PackagingController.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Linq; using System.Web.Mvc; using Orchard.Environment.Extensions; @@ -104,23 +103,4 @@ namespace Orchard.Modules.Packaging.Controllers { return RedirectToAction("Modules"); } } - - public class DownloadStreamResult : ActionResult { - public string FileName { get; set; } - public string ContentType { get; set; } - public Stream Stream { get; set; } - - public DownloadStreamResult(string fileName, string contentType, Stream stream) { - FileName = fileName; - ContentType = contentType; - Stream = stream; - } - - public override void ExecuteResult(ControllerContext context) { - context.HttpContext.Response.ContentType = ContentType; - context.HttpContext.Response.AddHeader("content-disposition", "attachment; filename=\"" + FileName + "\""); - Stream.Seek(0, SeekOrigin.Begin); - Stream.CopyTo(context.HttpContext.Response.OutputStream); - } - } } \ No newline at end of file