Split LeafOutputFile content into different table for performance

This commit is contained in:
2016-05-23 15:23:36 -04:00
parent 790e2494e3
commit 55f7b68bf8
21 changed files with 307 additions and 19 deletions
+38 -1
View File
@@ -1,8 +1,9 @@
using System;
using System.Linq;
using System.Web.Mvc;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Utility;
using LeafWeb.Web.Attributes;
using LeafWeb.Web.ViewModels.LeafInput;
using LeafWeb.Web.ViewModels.Results;
using LeafWeb.Web.ViewModels.ResultsAdmin;
@@ -20,6 +21,42 @@ namespace LeafWeb.Web.Controllers
return View(viewModel);
}
public ActionResult Details(int id)
{
var leafInput = DataService.GetLeafInput(id);
var viewModel = new LeafInputViewModel(leafInput);
return View(viewModel);
}
public ActionResult DownloadOutputToUser(int id)
{
return GetOutputZip(id, LeafOutputFileType.ToUser);
}
public ActionResult DownloadOutputNotToUser(int id)
{
return GetOutputZip(id, LeafOutputFileType.NotToUser);
}
public ActionResult DownloadOutputCleanedInput(int id)
{
return GetOutputZip(id, LeafOutputFileType.CleanedInput);
}
private ActionResult GetOutputZip(int id, LeafOutputFileType type)
{
var leafInput = DataService.GetLeafInput(id);
if (leafInput == null)
return View("DownloadNotFound");
var zip = leafInput.GetOutputFileZip(type);
var filename = $"{leafInput.Identifier.FilterValidFilename()}_{type}.zip";
return new FileContentResult(zip, "application/zip") { FileDownloadName = filename };
}
public ActionResult Delete(int id)
{
var leafInput = DataService.GetLeafInput(id);