using System; using System.IO; using System.Web.Mvc; using Kreta.Core; namespace Kreta.Web.Controllers { [AllowAnonymous] public class CacheController : Controller { /// /// Wraps the stored MemoryStream into an Excel file. /// /// Unique identifier of the file. /// File download name. /// Content type of the returned FileStream. /// The requested file as a FileStreamResult. [HttpGet] public ActionResult DownloadFile(Guid guid, string fileName, string contentType) { var stream = Cache.Get(guid) as MemoryStream; return new FileStreamResult(stream, contentType) { FileDownloadName = fileName }; } } }