Align .editorconfig files Move Controller logic to DMO classes GlobalVars.AppSettings = Models.AppSettings.GetFromConfigurationManager(); Question EditorConfig Project level editorconfig Format White Spaces AppSetting when EnvironmentVariable not set Corrective Actions Tests Schedule Actions Tests DMO Tests Controller Tests Get ready to use VSCode IDE
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
#if !NET8
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// <copyright file="BinaryContentResult.cs" company="SemanticArchitecture">
|
|
// http://www.SemanticArchitecture.net pkalkie@gmail.com
|
|
// </copyright>
|
|
// <summary>
|
|
// An ActionResult used to send binary data to the browser.
|
|
// </summary>
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
namespace Fab2ApprovalSystem.PdfGenerator {
|
|
using System.IO;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
/// <summary>
|
|
/// An ActionResult used to send binary data to the browser.
|
|
/// </summary>
|
|
public class BinaryContentResult : ActionResult {
|
|
private readonly string contentType;
|
|
private readonly byte[] contentBytes;
|
|
|
|
public BinaryContentResult(byte[] contentBytes, string contentType) {
|
|
this.contentBytes = contentBytes;
|
|
this.contentType = contentType;
|
|
}
|
|
|
|
public override void ExecuteResult(ControllerContext context) {
|
|
var response = context.HttpContext.Response;
|
|
response.Clear();
|
|
response.Cache.SetCacheability(HttpCacheability.Public);
|
|
response.ContentType = this.contentType;
|
|
|
|
using (var stream = new MemoryStream(this.contentBytes)) {
|
|
stream.WriteTo(response.OutputStream);
|
|
stream.Flush();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif |